Hello everyone !!
In this blog we are going to see how to interact with AWS console with CLI from our windows system.
Since we can launch any number of instances at AWS management console but we have certain limitations.
To use AWS in our own command prompt we need to install AWS on our system and have to configure it.
This has more privileges but we can’t access IAM using AWS CLI.

Now we are going to see some few basics commands for launching instance.

→ Creating key-pair.
→ Creating Security groups.
→ Launching Instances.
→Creating Volume(EBS).
→Attach Volume to Instance.

1.Creating Key-Pair
Aws Uses keys for encrypting and decrypting the login information. Keys consist of two key private and public key that’s why it is called Key-Pair. We use Key-Pair to connect with AWS instances.
Now let see how to create our own Key-Pair….

aws ec2 create-key-pair — key-name newkey

As we can see above ,it clearly shows the command for creating our own key-pair for connecting with instance. And when we login into management console it’ll show the key-pair with the name we used to create. Here I gave name as newkey.

2. Creating Security Groups.
Security Groups are exactly acts as a firewall which control both inbound and outbound traffic. It decides whether to allow or block request if some client send some request to our instance.
The below command is used for creating security groups.

aws ec2 create-security-group — description all traffic — group-name newsg — vpc-id vpc-25cb2b4e

VPC used for control how your network and the Amazon EC2 resources inside your network are exposed to the Internet. Here I gave my security name as newsg. Which allows all kind of traffic inside to my instance.

3. Launching Instance.
Launching Instance is same as like installing os in our system. To install os in any system we need os image AWS provide image in the name of AMI(Amazon Machine Image). To launch new os we need the below things.

→image-id (This id shows type of os i.e. Linux, windows, etc..)
→instance-type (Type of Instance i.e. Size of RAM and number of CPU core)
→count (Number of Instance)
→security-group-ids (The id of security group)
→key-name (Name of key-Pair)

aws ec2 run-instances — image-id ami-052c08d70def0ac62 — instance-type t2.micro — count 1 — subnet-id subnet-5b575e33 — security-group-ids sg-0f5b92dd31c120457 — key-name newkey

Now I am going to install Red Hat Linux os ,with the security groups and key-pair that we have created above.

4. Creating volume (EBS).
(Elastic Block Storage) is a block device that provides volume to store data. Block devices are used for OS installation purpose. And also to store our data persistent we need to use Block storage. Below is the command to create volume, I created the volume with 1GB.

aws ec2 create-volume — availability-zone ap-south-1a — size 1

Here Availability Zone is where we want to create our Storage i.e. in which zone . The one limitation we have on EBS is we can’t use EBS to the Instance which is from other zone.

5. Attach Volume to the instance.
EBS was created successfully and the thing remaining is we have to attach with our Instance to use that volume. For that we need Instance id and Volume id .

aws ec2 attach-volume — device /dev/sdf — instance-id i-0040d51c0c27484ae — volume-id vol-05eeab56151c275a3

After running this command the volume will get attach with the Instance. We can see that in the below image.

Thanks for reading my blog. You’ll get to know more things related to AWS. Stay tuned.

Finally I want to thank Mr. Vimal Daga sir for tweaking my skills.

ARTH Learner at LinuxWorld Informatics Pvt Ltd & AL ML Developer

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