๐Ÿ”บ Automating AWS through CLI ๐Ÿ”ป

In this article we will be Automating AWS using AWS CLI

So lets start

Firstly lets create a IAM user on AWS so that we can login through our local system Command prompt

Select Programmatic Access so that we can login through CLI
Give Power user
Remember the access key and Secret key

Now to login through Windows Command prompt run the following command

aws configure

Now we have finally login to AWS account through cmd prompt

Step 1: Create a key pair ๐Ÿ”ป

Firstly lets create Key pair

Here no need to remember all the commands we can use โ€œhelpโ€ cmd to get help

scroll down will get required cmds
aws ec2 create-key-pair โ€” key-name Task3-key-pair

Key pair Created

Step 2: Create a security group ๐Ÿ”ป

aws ec2 create-security-group โ€” group-name mytask3SG โ€” description โ€œMy task 3 SG โ€œ

Finally Security group Created

aws ec2 run-instances โ€” image-id ami-081bb417559035fe8 โ€” instance-type t2.micro โ€” subnet-id subnet-e5676e8d โ€” count 1 โ€” security-group-ids sg-0510ab305b73bbbe6 โ€” key-name Task3-key-pair

Successfully Instance Created

aws ec2 help
aws ec2 create-volume โ€” volume-type gp2 โ€” size 3 โ€” availability-zone ap-south-1a

Successfully Created volume of 3 Gib

aws ec2 attach-volume โ€” volume-id vol-0ee96decd8a9bf8a1 โ€” instance-id i-07a6f66189e45c729 โ€” device /dev/sdf

Finally EBS volume has been attached to the above created ec2 instance using CLI.

Hope it helped you ..!

Thanks for Reading ๐Ÿ˜โœŒ

Passionate learner || Data Science Enthusiast || Django || Competitive Programmer