AWS Command Line Interface (CLI)

Task Description

AWS CLI

Step 1: Create a key pair

aws ec2 create-key-pair

— key-name clikey

Step 2: Create a security group

aws ec2 create-security-group

— group-name cli-sg — description “CLI security group”

— vpc-id vpc-61829f09

aws ec2 authorize-security-group-ingress

— group-name cli-sg

— protocol tcp

— port 22

— cidr 0.0.0.0/0

Step 3: Launch an instance using the above created key pair and security group.

aws ec2 run-instances

— image-id ami-0e306788ff2473ccb

— instance-type t2.micro

— key-name clikey

— security-group-ids sg-0ef10e78b6ca565cd

— subnet-id subnet-0a420fc4eb459022a

— count 1

— tag-specifications=ResourceType=instance,Tags=[{Key=Name,Value=CLI-Instance}]

Step 4: Create an EBS volume of 1 GiB.

aws ec2 create-volume

— availability-zone ap-south-1a

— size 1

— volume-type gp2

— tag-specifications=ResourceType=volume,Tags=[{Key=Name,Value=EBS-CLI}]

Step 5: Attach the above created EBS volume to the instance.

aws ec2 attach-volume

— volume-id vol-055341a7f8c5f9142

— instance-id i-0d90e5539f15f7097

— device /dev/sdf

THANK YOU !!

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