AWS console managing via AWS CLI
Welcome you guys in my article based on AWS CLI.
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.
Process of completion:
- 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 AWS management console.
2. Configure AWS profile:
To configure the AWS profile for the first time we have to use following command-
aws configure [--profile profile-name]
Here, I have used already configured profile.
3. Create a key pair:
aws ec2 create-key-pair --key-name awscsatask
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" --group-name awstasksg --vpc-id vpc-03ad93c5504a4e790
Description of Security Group:
Here, desired security group is created.
5. Launch an instance using the above created key pair and security group:
aws ec2 run-instances --image-id ami03ab428f950fdc05a --security-group-ids sg-0fd8169e1f76f18d9 --instance-type t2.micro --count 1 --key-name awscsatask
Description of ec2 instance:
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 desired size.
7. Attach the above created EBS volume to the instance created in the previous step:
aws ec2 attach-volume --volume-id vol-04b297fe77490f54bd --instance-id i-033246ae49595f43c --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 vol-04b297fe77490f54bd
To stop or terminate the launched instance we have commands-
aws ec2 stop-instance --instance-ids i-033246ae49595f43c aws ec2 terminate-instance --instance-ids i-033246ae49595f43c
And here I am done with my task.
Thank you all for your time!!!
Solution-Oriented DevOps Engineer || Skilled in Kubernetes | Terraform | Ansible | Docker | Git and GitHub | GitHub Action || Expanding Capabilities in AWS | GCP | Linux.
4yGreat Nivedita Shinde ✨✨
DevOps @Forescout 🔐 | Google Developer Expert | AWS | DevOps | 3X GCP | 1X Azure | 1X Terraform | Ansible | Kubernetes | SRE | Platform | Jenkins | Tech Blogger 🚀
4yGreat Nivedita Shinde
Student @ Lost Stories Academy | Music
4yCongrats...
MTS 2 @Cohesity | Ex-Veritas | Kubernetes | Docker | Golang | Python
4yGreat work ✨