Accessing Aws Cloud From CLI

Abhishek kumar
4 min readOct 18, 2020


Aws cloud has its WebUI, which provides almost all the facilities. It is easy to use from graphical interface but In Industries CLI is used on a major way and by use of this, we can learn about Aws commands and internals.

Task description:

  1. create a security group
  2. create a private key
  3. Launch instance using these security group and private key
  4. create a EBS and attach to instance

First we have to create a setup through which we can access Aws from CLI. in this procedure we have to go Aws GUI portal and select IAM service.

Here give user name and give the both access programmatic and Aws management console. so, they can login in Aws account and access all the services. create a custom password that will use at the time of login in GUI using IAM user.

set the permission as PowerUserAccess.

Give a tag that will help in identify the user easily

Review and create the IAM user. These Access key and Secret key must be essential for login from CLI.

Lets’s setup the CLI, In my case I am using windows. For this setup you have to download and install Aws CLI. set the system environmental variable path.

Open windows command prompt run command “aws configure”. I have given random Access key and secret key. you have to give these keys from IAM user dashboard.

If you want to use ec2 service, then command “aws ec2 help” will help you find out all the commands related to this service. this is a good approach to know about command without remembering this.

Now we are ready to work on our task. for launching the security group run the command “ aws ec2 create-security-group — group-name <value> — description <value> ”

This is good practice to give a tag. for give the tag to SG run the command “ aws ec2 create-tags — resources <value> — tags <value> ”

Move to Aws web portal and you can see a new Security group is created.

Now for creating the Key-pairs, we have to run the command “ aws ec2 create-key-pair — key-name <value> ”

At Aws web portal a new key pair “Task3key” is created.

Now It’s time to launch the instance using these security group and key-pairs. command is “ aws ec2 run-instances —image-id <value> — instance-type <value> — count <value> — subnet-id <value> — security-groups-ids <value> — key-name <value>”

Give a tag to the instance

Now move to Aws web portal to check the instance state

For launching the EBS command is “ aws ec2 create-volume — availability-zone <value> — volume-type <value> — size <value> ”

Give a tag to EBS Volume, command “ aws ec2 create-tags — resources <value> — tags <value>”

At Aws portal EBS Volume is created

For attaching the EBS to Instance command is “ aws ec2 attach-volume — volume-id <value> — instance-id <value> — device <value>”

Now EBS Volume is in use with the Instance and ready to create partition and store the data.

Finally, Task is completed. Hope you like it.