The AWS Command Line Interface (CLI) is a unified tool that manages the AWS services for you.

AWS CLI gives you the ability to automate the entire process of controlling and managing AWS services through scripts. These scripts make it easy for users to fully automate cloud infrastructure.

Let’s perform the following using AWS CLI

Using aws help command, we can create our customized commands

Configure AWS using the command aws configure .Enter AWS Access key, Secret key, default region name and default output format

The following command creates a 2048-bit RSA key pair with the specified name.

aws ec2 create-key-pair  --key-name <value>
In AWS GUI you can see that a key pair has been created

A security group acts as a virtual firewall for your instance to
control inbound and outbound traffic.


aws ec2 create-security-group  --group-name <value> --description <value>
Through AWS GUI, we can confirm the created security group

Add the specified ingress rules to a security group. An inbound rule permits instances to receive traffic from the specified IPv4 or IPv6 CIDR address ranges, or from the instances associated with the specified destination security groups


aws ec2 authorize-security-group-ingress --group-id <value> --protocol <value> --port <value> --cidr <value>
The following command enables inbound traffic on TCP port 22 (SSH)
We can confirm here that the inbound rules has been specified

Launch the specified number of instances using an AMI .


aws ec2 run-instances --image-id <value> --instance-type <value> --key-name <value> --subnet-id <value> --count <value> --security-group-ids <value> --tag-specifications <value>
We can see here that an instance has been created

Create an EBS volume that can be attached to an instance in the same
Availability Zone.


aws ec2 create-volume  --availability-zone <value> --size <value>
Through GUI, we can confirm that an EBS volume has been created

Attaches an EBS volume to a running or stopped instance.


aws ec2 attach-volume --device <value>  --instance-id <value>  --volume-id <value>

Thanks for reading!!

-Vijaya Madhuri T A

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store