LAUNCHING AWS INSTANCE AND ATTACHING EBS VOLUME USING AWSCLI

LAUNCHING AWS INSTANCE AND ATTACHING EBS VOLUME USING AWSCLI

for performing this activity requires AWSCLI and some services of AWS like EC2 and EBS.

EC2 SERVICE :-

No alt text provided for this image

Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides secure, resizable compute capacity in the cloud. It is designed to make web-scale cloud computing easier for developers. Amazon EC2's simple web service interface allows you to obtain and configure capacity with minimal friction.

EBS SERVICE :-

No alt text provided for this image

Amazon Elastic Block Store (EBS) is an easy to use, high performance block storage service designed for use with Amazon Elastic Compute Cloud (EC2) for both throughput and transaction intensive workloads at any scale. A broad range of workloads, such as relational and non-relational databases, enterprise applications, containerized applications, big data analytics engines, file systems, and media workflows are widely deployed on Amazon EBS.


About the Task :-

? Create a key pair

? Create a security group

? Launch an instance using the above created key pair and security group.

? Create an EBS volume of 1 GB.

? The final step is to attach the above created EBS volume to the instance you created in the previous steps.

? All the above steps must be performed using AWS CLI.


Let's start the steps required to complete the task

First, download AWS CLI software and after downloading check the software is successfully installed in system or not.

use command :- aws --version


No alt text provided for this image

 set the access key and secret key by using “aws configure” command.

for this secret key and access key first create IAM user from there download the keys. This keys will help in accessing the AWS console its like username and password.

No alt text provided for this image

next step is to create key pair which will help in access the instances launched.

command:-

aws ec2 create-key-pair --key-name
No alt text provided for this image

Key pair has been successfully created. You can confirm with AWS portal also.

No alt text provided for this image

now create security group which will allow traffic/services coming in or going out.

command :-

aws ec2 create-security-group --description { } --group-name { }
No alt text provided for this image

Security group has been created. check it from AWS portal.

No alt text provided for this image

 launch an instance using above created Key pair and Security group.

command :-

aws ec2 run-instances --image-id { } --instance-type { } --count {} --subnet-id { } --security-group-id { } --key-name {}


No alt text provided for this image

Let’s go to the AWS portal and see whether the instance has been launched or not.

No alt text provided for this image

Instance has been launched successfully.

Now it’s time to create a EBS volume depending upon requirement.

command :-

aws ec2 create-volume --availability-zone {} --size {} --volume-type gp2
No alt text provided for this image

check whether volume is created or not.

No alt text provided for this image

now attach the created volume to the instances launched.

command :-

aws attach-volume --device /dev/xvdh --instance-id {} --volume-id {}
No alt text provided for this image

go to the AWS console whether the volume is connected or not.

No alt text provided for this image

Volume has been attached successfully. Let’s confirm from the instance page also.

No alt text provided for this image

Hence we have launched the instance and attached the volume created, hence the final goal of task has been acheived.

THANKYOU!!!.... HAVE A GREAT DAY......

要查看或添加评论,请登录

Manmohan .的更多文章

社区洞察