Upload
others
View
10
Download
0
Embed Size (px)
Citation preview
Getting Started with AWS Command Line Tools on Windows 1
Getting Started with
AWS Command Line
Tools on Windows
By Firoz Sabaliya
2 Getting Started with AWS Command Line Tools on Windows
Contents
I. Basic Installation steps ........................................................................................................ 4
1. Download the AWS Command Line Tool for windows from Amazon site: https://aws.amazon.com/cli/ ................................................................................................... 4
2. Install the exe file. .................................................................................................................................... 5
3. Verify your AWS CLI in your installation directory. ......................................................................... 6
II. Create IAM user and attach user policy using AWS management console ........................................................................................................... 7
1. Sign in your AWS account using email id and password .................................................................. 7
2. Go To Amazon IAM .............................................................................................................................. 8
3. Create a New user ................................................................................................................................... 8
4. Enter user name, tick “ generate an access key pair for each user” and click on “Create” button ............................................................................................................................. 9
5. After successful creation of user click on “Download Credentials” ............................................... 9
6. One CSV file will be downloaded in your PC. Open that file in notepad. You can see your username, Access key and Secrete Access key in text format ........................................................................................................................................................... 10
7. Now we have to assign user policy to newly created user. Click on “Attach user policy” permission tab on same page IAM. ........................................................................... 10
8. Select “Administrator Access” ............................................................................................................ 11
9. Then click on “ Apply Policy” ............................................................................................................ 12
10. Verify user policy ................................................................................................................................... 13
III. Execute AWS Commands using windows command prompt ............................................ 14
1. Open “Run” window and type “cmd” ............................................................................................. 14
2. Go to Amazon folder. .......................................................................................................................... 15
3. Enter your IAM credentials ................................................................................................................. 16
IV. Create EC2 instance using AWS Command Line Tool ...................................................... 17
1. Check any instance running on your AWS account ........................................................................ 17
2. Create a new key pair ............................................................................................................................ 18
3. Let’s change the output display format as “table” ........................................................................... 19
4. Now create a security group ................................................................................................................ 20
Getting Started with AWS Command Line Tools on Windows 3
5. Verify security group is created. .......................................................................................................... 21
6. Make sure you have selected proper region ...................................................................................... 21
7. To create EC2 instance first you have get AMI id ........................................................................... 22
8. Command for creating EC2 instance ................................................................................................. 23
9. Verify your EC2 instance is created ................................................................................................... 24
10. Don’t forgot to delete EC2 instance .................................................................................................. 24
4 Getting Started with AWS Command Line Tools on Windows
Basic Installation steps
1. Download the AWS Command Line Tool for windows from Amazon site:
https://aws.amazon.com/cli/
Getting Started with AWS Command Line Tools on Windows 5
2. Install the exe file.
6 Getting Started with AWS Command Line Tools on Windows
3. Verify your AWS CLI in your installation directory.
Here in my case it is C:\Program Files\Amazon\AWSCLI
Getting Started with AWS Command Line Tools on Windows 7
Create IAM user and attach user policy using AWS
management console
1. Sign in your AWS account using email id and password
8 Getting Started with AWS Command Line Tools on Windows
2. Go To Amazon IAM
3. Create a New user
Getting Started with AWS Command Line Tools on Windows 9
4. Enter user name, tick “ generate an access key pair for each user” and click
on “Create” button
5. After successful creation of user click on “Download Credentials”
10 Getting Started with AWS Command Line Tools on Windows
6. One CSV file will be downloaded in your PC. Open that file in notepad. You
can see your username, Access key and Secrete Access key in text format
7. Now we have to assign user policy to newly created user. Click on “Attach
user policy” permission tab on same page IAM.
Getting Started with AWS Command Line Tools on Windows 11
8. Select “Administrator Access”
12 Getting Started with AWS Command Line Tools on Windows
9. Then click on “ Apply Policy”
Getting Started with AWS Command Line Tools on Windows 13
10. Verify user policy
14 Getting Started with AWS Command Line Tools on Windows
Execute AWS Commands using windows
command prompt
1. Open “Run” window and type “cmd”
Getting Started with AWS Command Line Tools on Windows 15
2. Go to Amazon folder.
In my case: cd C:\Program Files\Amazon\AWSCLI\awscli
Type: aws help (To verify CLI installation)
16 Getting Started with AWS Command Line Tools on Windows
3. Enter your IAM credentials
Type command: aws configure
Then enter your AWS access key ID, AWS secret access key, region name (default
value: us-west-2) and output format (default value: json)
Getting Started with AWS Command Line Tools on Windows 17
Create EC2 instance using AWS Command Line
Tool
1. Check any instance running on your AWS account
CMD: aws ec2 describe-instances
18 Getting Started with AWS Command Line Tools on Windows
2. Create a new key pair
a. Give any name to key pair (In my case “attune-key”)
b. CMD: aws ec2 create-key-pair --key-name "attune-key"
Getting Started with AWS Command Line Tools on Windows 19
3. Let’s change the output display format as “table”
20 Getting Started with AWS Command Line Tools on Windows
4. Now create a security group
Cmd: aws ec2 create-security-group --group-name "attune-group" --description "attune"
Getting Started with AWS Command Line Tools on Windows 21
5. Verify security group is created.
6. Make sure you have selected proper region
22 Getting Started with AWS Command Line Tools on Windows
7. To create EC2 instance first you have get AMI id
a. To get ami id go to EC2 Dash board then click on Launch instance
b. Get the Amazon Linux AMI id
Getting Started with AWS Command Line Tools on Windows 23
8. Command for creating EC2 instance
aws ec2 run-instances --image-id ami-043a5034 --count 1 --instance-type t1.micro --key-
name attune-key --security-groups attune-group
24 Getting Started with AWS Command Line Tools on Windows
9. Verify your EC2 instance is created
10. Don’t forgot to delete EC2 instance
Cmd: aws ec2 terminate-instances --instance-ids i-4887b840
Get your instance id from above screen