AWS CLI — What it is and how we use it?

Installing the AWS CLI version 2 :

  • First, download AWS CLI MSI Installer using link.
  • Run the downloaded MSI installer and follow the on-screen instructions. By default, the AWS CLI installs to C:\Program Files\Amazon\AWSCLIV2.
  • Now to confirm the installation, Open CMD and at the command prompt run the aws --version command.

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.

1. Creating a Key-Pair:

aws ec2 create-key-pair --key-name {{key_name}}

2. Creating Security Group:

aws ec2 create-security-group --group-name {{sg_name}} --description "details for SG"

aws ec2 authorize-security-group-ingress --protocol tcp --port 22 --group-name {{sg_name}} --cidr 0.0.0.0/0

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

aws ec2 run-instances --image-id {{ami_id}} --instance-type {{t2.micro}} --count 1 --security-group-ids {{..id..}} --key-name {{..name..}}

4. Create an EBS volume of 1 GB:

aws ec2 create-volume --availability-zone {{zone}} --size {{size in GB}}

5. Attach to above created EBS to instance which we launched above:

aws ec2 attach-volume --device {{/dev/sdf}} --instance-id {{..id..}} --volume-id {{..id..}}

--

--

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