USING AWS FROM WINDOWS CLI

Mohd Mubin Girach
4 min readOct 19, 2020

Hola readers ,

This blog will cover

  • Installing AWS cli in Windows
  • Creating Key pair
  • Creating Security group
  • Launching an instance
  • Creating and attaching an EBS volume to the instance

So lets start

For installing the AWS you need to download the .msi file available for windows

After Downloading install the file as usual by doing next >install …^_^

After installation is completed open cmd to verify the installation

type in aws -- version

OUTPUT

Now as we have installed it

Let’s make a link between our AWS and cli

  • Now as we have linked/authenticated our aws account
  • To create a key pair
  • Use aws ec2 create-key-pair --key-name (ANY DESIRED NAME)

We need to create a security group for maintaining the security of the instance

Use command aws ec2 create-security-group --description <value>

--group-name <value> --vpc-id <value>

Wherein the description and group name can be customized as per the user for easy identification while implementing it for any instance & vpc id is as available in ec2 dashboard

You will get the output as below

Now if needed we can manage/configure the incoming and out going traffic in the security group known as inbound and outbound rules

Further details for implementing it can be found using the command

aws ec2 authorize-security-group-ingress help

Lets launch an instance (an operating system ) with the above created key pair and security group

The basic requirements for launching an instance are

Amazon machine image (ami) id of the o.s we wish to launch which can be found in the Launch instance wizard page

  • The type of instance
  • Number of instance
  • Subnet id for selecting the centre for launching the instances which can be customized as desired
  • Security group id
  • Key name

The command including all above parameter’s as to launch an instance successfully would be

aws ec2 run-instances --image-id ami-0e306788ff2473ccb --instance-type t2.micro count 1 --subnet-id subnet-5fb1b837--security-group-ids sg-0aff41b5c750842a6 --key-name ANYNAME

And your instance is launched visit your dashboard !

Lets give it a name

aws ec2 create-tags --resources i-0d53bde245ae2c864(your instance id) --tags Key=Name,Value=NEWINSTANCE(Any name)

Now for creating an EBS ,

aws ec2 create-volume --availability-zone ap-south-1a --size 1(as required)

Verify it in Elastic Block Store>Volumes

Now to connect it to our instance

aws ec2 attach-volume --instance-id i-0d53bde245ae2c864 --volume-id vol-0e9e270e305dde648 --device /dev/sdf

The info is available in ec2 dashboard>Your instance>Storage

Thanks….

--

--

Mohd Mubin Girach

Technology Enthusiast | Cloud & DevOps Engineer | Cyber Security Researcher