Launching New Instance Using AWS CLI !!!!
Anushka Visapure
Solution-Oriented DevOps Engineer || Skilled in Kubernetes | Terraform | Ansible | Docker | Git and GitHub | GitHub Action || Expanding Capabilities in AWS | GCP | Linux.
Task Description:
?? 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.
Amazon Web Services:
Amazon Web Services (AWS) is a subsidiary of Amazon providing on-demand cloud computing platforms and APIs to individuals, companies, and governments, on a metered pay-as-you-go basis. These cloud computing web services provide a variety of basic abstract technical infrastructure and distributed computing building blocks and tools. One of these services is Amazon Elastic Compute Cloud (EC2), which allows users to have at their disposal a virtual cluster of computers, available all the time, through the Internet.
STEPS :
- Install AWS CLI:
I have installed AWS CLI. To check whether it is installed or not use the following command:
aws --version
Here, I have successfully installed AWS CLI. Now we can use it to do the things automatically in the AWS management console.
2. Configure AWS profile:
To configure the AWS profile for the first time we have to use the following command-
aws configure [--profile profile-name]
3. Create a key pair :
aws ec2 create-key-pair --key-name aws_task_1
Description of key pair:
Now, we can see our key pair is created.
4. Create a security group:
aws ec2 create-security-group --description "sg_aws_task_1" --group-name awstask1 --vpc-ids vpc-053bdb6e
Description of Security Group:
Here, the desired security group is created.
5. Launch an instance using the above created key pair and security group:
aws ec2 run-instances --image-id "image_id "--security-group-ids "security_group_id" --instance-type "t2.micro" --count 1 --key-name "key_name"
Description of ec2 instance:
The instance is successfully created.
6. Create an EBS volume of 1 GB:
aws ec2 create-volume --availability-zone ap-south-1a --volume-type gp2 --size 1
You can see here volume is created with the desired size.
7. Attach the above created EBS volume to the instance created in the previous step:
aws ec2 attach-volume --volume-id "volume_id" --instance-id "instance_id " --device /dev/xvdh
Here, our created EBS volume is successfully attached to the instance.
Now, we can detach this volume by using-
aws ec2 detach-volume --volume-id "volume_id"
To stop or terminate the launched instance we have commands-
aws ec2 stop-instance --instance-ids "instance_id"
aws ec2 terminate-instance --instance-ids "instance_id"
And here I am done with my task.
Thanks for reading !!!!!!
Software Developer @FYNDNA
4 年Great ??
DevOps Engineer @Drona Pay | Redhat Certified | Freelancer Skilled at AWS | GCP | Azure | Terraform | Kubernetes | Ansible | Git ,GitHub | Linux | Openshift | Big Data | ML | DL | Python | C++
4 年Gr8 Job
SDE At Siemens
4 年Great Work
Sr. Cloud Engineer @Searce | DevOps & Kubernetes Enthusiast | Building Resilient Cloud-Native Applications
4 年Great work, anushka? Well done