Top Banner
TEL AVIV ©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved
102

TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Jun 09, 2018

Download

Documents

hadat
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

TEL AVIV

©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved

Page 2: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved

Deep Dive: AWS Command Line Interface

Danilo Poccia, Technical Evangelist, AWS

@danilop

Page 3: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

CRASH

COURSE

Intro to the AWS CLI

FOUNDATIONADVANCED

SCENARIOS

Exploring Key

Functionality

Looking at Advanced

CLI Features

Page 4: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Crash CourseIntro to the AWS CLI

Page 5: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

AWS Command Line InterfaceUnified tool to manage your AWS services

Page 6: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

MSI (Windows)

Bundled (cross platform)

pip (cross platform)

Page 7: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws configure

Page 8: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

$ aws ec2 describe-instances

Service (command) Operation (subcommand)

Page 9: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

$ aws iam list-access-keys

Service (command) Operation (subcommand)

Page 10: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

{"Places": [

{ "City": "Seattle",

"State": "WA" }, {

"City": "Las Vegas","State": "NV"

} ]

}

--output json

Page 11: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

PLACES Seattle WAPLACES Las Vegas NV

--output text

Page 12: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

--------------------------| SomeOperationName | +------------------------+ || Places || |+------------+---------+| || City | State || |+------------+---------+| || Seattle | WA || || Las Vegas | NV || |+------------+---------+|

--output table

Page 13: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

All Outputs

JSON Text

PLACES Seattle WA

PLACES Las Vegas NV

Table

--------------------------| SomeOperationName | +------------------------+ || Places || |+------------+---------+| || City | State || |+------------+---------+| || Seattle | WA || || Las Vegas | NV || |+------------+---------+|

{"Places": [

{ "City": "Seattle", "State": "WA"

}, {

"City": ”Las Vegas","State": "NV"

} ]

}

Page 14: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Demo

Basic AWS CLI Usage

Page 15: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

FoundationExploring Key Functionality

Page 16: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Configuration

Page 17: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws configure

Page 18: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws configure

AWS Access Key ID [**ABCD]: AWS Secret Access Key [****************EFGH]: Default region name [us-west-2]: Default output format [None]:

Page 19: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws configure <subcommand>

Page 20: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

list - list common configuration sourcesget - get the value of a single config varset - set the value of a single config var

aws configure <subcommand>

Page 21: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws configure get region

Page 22: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws configure set region eu-west-1

Page 23: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

A profile is a group of configuration values

Page 24: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws configure --profile prod

Page 25: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws configure set profile.prod.region eu-west-1

Page 26: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Configuration Files

~/.aws/credentials ~/.aws/config

• Supported by all AWS SDKs

• Only contains credentials

• Used only by the CLI

• Can contain credentials

(but not the default behavior)

Page 27: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

~/.aws/credentials ~/.aws/config

Page 28: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws configure set profile.prod.aws_access_key_id foo

~/.aws/credentials ~/.aws/config

Page 29: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws configure set profile.prod.aws_access_key_id foo

~/.aws/credentials

[prod]

aws_access_key_id = foo

~/.aws/config

Page 30: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws configure set profile.prod.aws_secret_access_key bar

~/.aws/credentials ~/.aws/config

[prod]

aws_access_key_id = foo

Page 31: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws configure set profile.prod.aws_secret_access_key bar

~/.aws/credentials

[prod]

aws_access_key_id = foo

aws_secret_access_key = bar

~/.aws/config

Page 32: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws configure set profile.prod.region euwest1

~/.aws/credentials

[prod]

aws_access_key_id = foo

aws_secret_access_key = bar

~/.aws/config

Page 33: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws configure set profile.prod.region euwest1

~/.aws/credentials

[prod]

aws_access_key_id = foo

aws_secret_access_key = bar

[profile prod]

region = eu-west-1

~/.aws/config

Page 34: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws configure set profile.prod.output text

~/.aws/credentials

[prod]

aws_access_key_id = foo

aws_secret_access_key = bar

[profile prod]

region = eu-west-1

~/.aws/config

Page 35: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws configure set profile.prod.output text

~/.aws/credentials

[prod]

aws_access_key_id = foo

aws_secret_access_key = bar

[profile prod]

region = eu-west-1

output = text

~/.aws/config

Page 36: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

create-new-user.sh

aws iam create-user --user-name summit-user

= aws iam create-access-key -username summit-user \

--query \

--output text

= | cut -d -f 1

= | cut -d -f 2

aws configure profile.summit.aws_access_key_id

aws configure profile.summit.secret_access_key

Page 37: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws iam create-user --user-name summit-user

= aws iam create-access-key -username summit-user \

--query \

--output text

= | cut -d -f 1

= | cut -d -f 2

aws configure profile.summit.aws_access_key_id

aws configure profile.summit.secret_access_key

create-new-user.sh

Page 38: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws iam create-user --user-name summit-user

= aws iam create-access-key -username summit-user \

--query \

--output text

= | cut -d -f 1

= | cut -d -f 2

aws configure profile.summit.aws_access_key_id

aws configure profile.summit.secret_access_key

create-new-user.sh

Page 39: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws iam create-user --user-name summit-user

= aws iam create-access-key -username summit-user \

--query \

--output text

= | cut -d -f 1

= | cut -d -f 2

aws configure profile.summit.aws_access_key_id

aws configure profile.summit.secret_access_key

create-new-user.sh

Page 40: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws iam create-user --user-name summit-user

= aws iam create-access-key -username summit-user \

--query \

--output text

= | cut -d -f 1

= | cut -d -f 2

aws configure profile.summit.aws_access_key_id

aws configure profile.summit.secret_access_key

create-new-user.sh

Page 41: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws iam create-user --user-name summit-user

= aws iam create-access-key -username summit-user \

--query \

--output text

= | cut -d -f 1

= | cut -d -f 2

aws configure profile.summit.aws_access_key_id

aws configure profile.summit.secret_access_key

create-new-user.sh

Page 42: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Use the

aws configure suite of subcommands

Page 43: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Query

Page 44: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

-query (string)

A JMESPath query to use in

filtering the response data.

Page 45: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Implementation Details --query Processing

Page 46: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Implementation Details --query Processing

Page 47: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Implementation Details --query Processing

Page 48: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Implementation Details --query Processing

Page 49: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Implementation Details --query Processing

--query User[0].[UserName,Path,UserId]

Page 50: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Implementation Details --query Processing

--query User[0].[UserName,Path,UserId]

Page 51: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Implementation Details --query Processing

Page 52: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Implementation Details --query Processing

Page 53: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

http://jmespath.org

A Query Language for JSON

Page 54: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Demo

JMESPATH

Page 55: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

http://jmespath.org

A Query Language for JSON

Page 56: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Waiters

Page 57: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Amazon EC2 Instance State Transitions

Page 58: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

ec2-instance-running.sh

#!/bin/bash instance_id=$(aws ec2 run-instances --image-id ami-12345 \

--query Reservations[].Instances[].InstanceId \--output text)

instance_state=$(aws ec2 describe-instances --instance-ids $instance_id \--query 'Reservations[].Instances[].State.Name')

while [ "$instance_state" != "running" ] do

sleep 1 instance_state=$(aws ec2 describe-instances --instance-ids $instance_id \--query 'Reservations[].Instances[].State.Name')

done

Page 59: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

#!/bin/bash instance_id=$(aws ec2 run-instances --image-id ami-12345 \

--query Reservations[].Instances[].InstanceId \--output text)

instance_state=$(aws ec2 describe-instances --instance-ids $instance_id \--query 'Reservations[].Instances[].State.Name')

while [ "$instance_state" != "running" ] do

sleep 1 instance_state=$(aws ec2 describe-instances --instance-ids $instance_id \--query 'Reservations[].Instances[].State.Name')

done

ec2-instance-running.sh

Page 60: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

#!/bin/bash instance_id=$(aws ec2 run-instances --image-id ami-12345 \

--query Reservations[].Instances[].InstanceId \--output text)

instance_state=$(aws ec2 describe-instances --instance-ids $instance_id \--query 'Reservations[].Instances[].State.Name')

while [ "$instance_state" != "running" ] do

sleep 1 instance_state=$(aws ec2 describe-instances --instance-ids $instance_id \--query 'Reservations[].Instances[].State.Name')

done

ec2-instance-running.sh

Page 61: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

#!/bin/bash instance_id=$(aws ec2 run-instances --image-id ami-12345 \

--query Reservations[].Instances[].InstanceId \--output text)

instance_state=$(aws ec2 describe-instances --instance-ids $instance_id \--query 'Reservations[].Instances[].State.Name')

while [ "$instance_state" != "running" ] do

sleep 1 instance_state=$(aws ec2 describe-instances --instance-ids $instance_id \--query 'Reservations[].Instances[].State.Name')

done

ec2-instance-running.sh

Page 62: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

#!/bin/bash instance_id=$(aws ec2 run-instances --image-id ami-12345 \

--query Reservations[].Instances[].InstanceId \--output text)

instance_state=$(aws ec2 describe-instances --instance-ids $instance_id \--query 'Reservations[].Instances[].State.Name')

while [ "$instance_state" != "running" ] do

sleep 1 instance_state=$(aws ec2 describe-instances --instance-ids $instance_id \--query 'Reservations[].Instances[].State.Name')

done

ec2-instance-running.sh

Page 63: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

#!/bin/bash instance_id=$(aws ec2 run-instances --image-id ami-12345 \

--query Reservations[].Instances[].InstanceId \--output text)

instance_state=$(aws ec2 describe-instances --instance-ids $instance_id \--query 'Reservations[].Instances[].State.Name')

while [ "$instance_state" != "running" ] do

sleep 1 instance_state=$(aws ec2 describe-instances --instance-ids $instance_id \--query 'Reservations[].Instances[].State.Name')

done

ec2-instance-running.sh

Page 64: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

ec2-waiters.sh

instance_id=$(aws ec2 run-instances --image-id ami-12345 \--query Reservations[].Instances[].InstanceId \--output text)

aws ec2 wait instance-running --instance-ids $instance_id

Page 65: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

instance_id=$(aws ec2 run-instances --image-id ami-12345 \--query Reservations[].Instances[].InstanceId \--output text)

aws ec2 wait instance-running --instance-ids $instance_id

ec2-waiters.sh

subcommand

Describe-instances options

waiter name

Page 66: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Advanced ScenariosLooking at advanced AWS CLI features

Page 67: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Templates

Page 68: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

The AWS CLI is data driven

Page 69: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Implementation Details JSON Models

Page 70: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Implementation Details JSON Models

Page 71: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Implementation Details JSON Models

Page 72: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws ec2 run‐instances --cli-input-json file://arguments.json

Page 73: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws ec2 run‐instances --generate-cli-skeleton

Page 74: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Demo

Creating and using JSON templates

Page 75: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Credential Providers

Page 76: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Credential Providers

Page 77: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Credential Providers

Page 78: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Credential Providers

Page 79: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Credential Providers

Page 80: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Credential Providers

Page 81: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Delegate access to AWS resources usingAWS Identity and Access Management (IAM) roles

Page 82: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

IAM Roles

Production Development

Page 83: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

IAM Roles

Production Development

Page 84: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

v

IAM Roles

Production Development

Role

Policy

Trust Policy

role

Page 85: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

IAM Roles

Production Development

AssumeRole

AWS Security

Token Service

role

Page 86: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

IAM Roles

Production Development

AssumeRole

AWS Security

Token Service

role

token

Page 87: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

IAM Roles

Production Development

AssumeRole

AWS Security

Token Service

role

token

Page 88: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws configure set profile.prodrole.source_profile dev

aws configure set profile.prodrole.role_arn arn:aws:iam…

configure-role.sh

Page 89: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

~/.aws/credentials ~/.aws/config

[profile prodrole]

role_arn = arn:aws:iam.......

source_profile = dev

Page 90: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

~/.aws/credentials ~/.aws/config

[profile prodrole]

role_arn = arn:aws:iam

source_profile = dev

Page 91: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Demo

Using roles with the AWS CLI

Page 92: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Amazon S3 Streaming

Page 93: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws s3 cp

Page 94: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

We want to avoid disk

Page 95: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws s3 cp – s3://bucket/key

Page 96: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws s3 cp s3://bucket/key -

Page 97: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Compress

Page 98: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

aws s3 cp s3://bucket/key ‐ | \bzip2 -best | \aws s3 cp - s3://bucket/key.bz2

Page 99: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Summary

Page 100: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

Wrapping Up

• Configuration

• Waiters

• Query

• Templates

• Credential Providers

• Amazon S3 Streaming

Page 101: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

For More Information

https://github.com/aws/aws-cli

http://docs.aws.amazon.com/cli/latest/userguide/

https://forums.aws.amazon.com/forum.jspa?forumID=150

http://docs.aws.amazon.com/cli/latest/reference/

http://jmespath.org/

Page 102: TEL AVIV AVIV ©2015, Amazon Web Services, Inc. or its affiliates. ... Deep Dive: AWS Command Line Interface ... Intro to the AWS CLI FOUNDATION ADVANCED …

TEL AVIV

Danilo Poccia

@danilop