Sitemap

Accessing Aws Cloud From CLI

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.

Press enter or click to view image in full size

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.

Press enter or click to view image in full size

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.

Press enter or click to view image in full size
Press enter or click to view image in full size

set the permission as PowerUserAccess.

Press enter or click to view image in full size

Give a tag that will help in identify the user easily

Press enter or click to view image in full size

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

Press enter or click to view image in full size

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.

https://awscli.amazonaws.com/AWSCLIV2.msi

Press enter or click to view image in full size

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.

Press enter or click to view image in full size

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> ”

Press enter or click to view image in full size

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> ”

Press enter or click to view image in full size

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

Press enter or click to view image in full size

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

Press enter or click to view image in full size

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

Press enter or click to view image in full size

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>”

Press enter or click to view image in full size

Give a tag to the instance

Press enter or click to view image in full size

Now move to Aws web portal to check the instance state

Press enter or click to view image in full size

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

Press enter or click to view image in full size

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

Press enter or click to view image in full size

At Aws portal EBS Volume is created

Press enter or click to view image in full size

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

Press enter or click to view image in full size

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

Press enter or click to view image in full size
Press enter or click to view image in full size

Finally, Task is completed. Hope you like it.