155
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Kyle Knapp, Amazon Web Services December 1, 2016 DEV402 The Effective AWS CLI User

AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Embed Size (px)

Citation preview

Page 1: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Kyle Knapp, Amazon Web Services

December 1, 2016

DEV402

The Effective AWS CLI User

Page 2: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Important:

This talk will be advanced

Page 3: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Background Material

• AWS CLI User Guide

• AWS CLI Command Reference

• 2015 AWS CLI re:Invent talk

• 2014 AWS CLI re:Invent talk

• 2013 AWS CLI re:Invent talk

Page 4: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Background Material

• AWS CLI User Guide

• AWS CLI Command Reference

• 2015 AWS CLI re:Invent talk

• 2014 AWS CLI re:Invent talk

• 2013 AWS CLI re:Invent talk

Slides will be online!

Page 5: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Unified tool to manage AWS services

AWS Command Line Interface

Page 6: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

The Effective AWS CLI User Tenets

The effective AWS CLI user:

Page 7: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

The Effective AWS CLI User Tenets

The effective AWS CLI user:

Uses an iterative workflow

Page 8: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

The Effective AWS CLI User Tenets

The effective AWS CLI user:

Uses an iterative workflow

Troubleshoots well

Page 9: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

The Effective AWS CLI User Tenets

The effective AWS CLI user:

Uses an iterative workflow

Troubleshoots well

Is resourceful with tooling

Page 10: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

The Effective AWS CLI User Tenets

The effective AWS CLI user:

Uses an iterative workflow

Troubleshoots well

Is resourceful with tooling

Understands performance implications

Page 11: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

A Sample Application

Page 12: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Amazon VPC

Page 13: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Amazon VPC Amazon EC2

Page 14: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Amazon VPC Amazon EC2 IAM

Page 15: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Amazon VPC Amazon EC2 IAM Amazon S3

Page 16: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

AWS Cloud

Page 17: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

VPC

10.0.0.0/16

AWS Cloud

router

Destination Target

10.0.0.0/16 local

Page 18: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

VPC

10.0.0.0/16

Subnet

10.0.0.0/24

AWS Cloud

router

Destination Target

10.0.0.0/16 local

Page 19: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

VPC

10.0.0.0/16

Subnet

10.0.0.0/24

AWS Cloud

Internet

gateway

router

Destination Target

10.0.0.0/16 local

0.0.0.0/0 igw-id

Page 20: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

VPC

10.0.0.0/16

Subnet

10.0.0.0/24

security group

AWS Cloud

Internet

gateway

router

Destination Target

10.0.0.0/16 local

0.0.0.0/0 igw-id

Page 21: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

VPC

10.0.0.0/16

Subnet

10.0.0.0/24

security group

AWS Cloud

instance

Internet

gateway

router

Destination Target

10.0.0.0/16 local

0.0.0.0/0 igw-id

role

Page 22: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

VPC

10.0.0.0/16

Subnet

10.0.0.0/24

security group

AWS Cloud

instance

Internet

gateway

router

Amazon

S3

Destination Target

10.0.0.0/16 local

0.0.0.0/0 igw-id

role

Page 23: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

The Effective AWS CLI User Tenets

The effective AWS CLI user:

Uses an iterative workflow

Page 24: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 create-vpc --cidr-block 10.0.0.0/16

Page 25: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 create-vpc --cidr-block 10.0.0.0/16

{

"Vpc": {

"VpcId": "vpc-24de2d4d",

"InstanceTenancy": "default",

"State": "pending",

"DhcpOptionsId": "dopt-f8ca2291",

"CidrBlock": "10.0.0.0/16",

"IsDefault": false

}

}

Page 26: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 create-vpc --cidr-block 10.0.0.0/16

{

"Vpc": {

"VpcId": "vpc-24de2d4d",

"InstanceTenancy": "default",

"State": "pending",

"DhcpOptionsId": "dopt-f8ca2291",

"CidrBlock": "10.0.0.0/16",

"IsDefault": false

}

}

Page 27: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 create-vpc --cidr-block 10.0.0.0/16

{

"Vpc": {

"VpcId": "vpc-24de2d4d",

"InstanceTenancy": "default",

"State": "pending",

"DhcpOptionsId": "dopt-f8ca2291",

"CidrBlock": "10.0.0.0/16",

"IsDefault": false

}

}

$ vpc_id=vpc-24de2d4d

Page 28: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 create-vpc --cidr-block 10.0.0.0/16

{

"Vpc": {

"VpcId": "vpc-24de2d4d",

"InstanceTenancy": "default",

"State": "pending",

"DhcpOptionsId": "dopt-f8ca2291",

"CidrBlock": "10.0.0.0/16",

"IsDefault": false

}

}

$ vpc_id=vpc-24de2d4dWe can do better…

Page 29: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ vpc_id=$(aws ec2 create-vpc --cidr-block 10.0.0.0/16 \

--query Vpc.VpcId --output text)

Page 30: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ vpc_id=$(aws ec2 create-vpc --cidr-block 10.0.0.0/16 \

--query Vpc.VpcId --output text)

{"Vpc": {

"VpcId": "vpc-24de2d4d", "InstanceTenancy": "default", "State": "pending", "DhcpOptionsId": "dopt-f8ca2291", "CidrBlock": "10.0.0.0/16", "IsDefault": false

}}

Page 31: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ vpc_id=$(aws ec2 create-vpc --cidr-block 10.0.0.0/16 \

--query Vpc.VpcId --output text)

{"Vpc": {

"VpcId": "vpc-24de2d4d", "InstanceTenancy": "default", "State": "pending", "DhcpOptionsId": "dopt-f8ca2291", "CidrBlock": "10.0.0.0/16", "IsDefault": false

}}

Page 32: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ vpc_id=$(aws ec2 create-vpc --cidr-block 10.0.0.0/16 \

--query Vpc.VpcId --output text)

{"Vpc": {

"VpcId": "vpc-24de2d4d", "InstanceTenancy": "default", "State": "pending", "DhcpOptionsId": "dopt-f8ca2291", "CidrBlock": "10.0.0.0/16", "IsDefault": false

}}

Page 33: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ vpc_id=$(aws ec2 create-vpc --cidr-block 10.0.0.0/16 \

--query Vpc.VpcId --output text)

{"Vpc": {

"VpcId": "vpc-24de2d4d", "InstanceTenancy": "default", "State": "pending", "DhcpOptionsId": "dopt-f8ca2291", "CidrBlock": "10.0.0.0/16", "IsDefault": false

}}

Page 34: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ vpc_id=$(aws ec2 create-vpc --cidr-block 10.0.0.0/16 \

--query Vpc.VpcId --output text)

{"Vpc": {

"VpcId": "vpc-24de2d4d", "InstanceTenancy": "default", "State": "pending", "DhcpOptionsId": "dopt-f8ca2291", "CidrBlock": "10.0.0.0/16", "IsDefault": false

}}

Page 35: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ vpc_id=$(aws ec2 create-vpc --cidr-block 10.0.0.0/16 \

--query Vpc.VpcId --output text)

$ echo "$vpc_id”

vpc-24de2d4d

Page 36: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ vpc_id=$(aws ec2 create-vpc --cidr-block 10.0.0.0/16 \

--query Vpc.VpcId --output text)

$ echo "$vpc_id"

vpc-24de2d4d

$ create_vpc_output=$(aws ec2 create-vpc --cidr-block 10.0.0.0/16)

Page 37: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ vpc_id=$(aws ec2 create-vpc --cidr-block 10.0.0.0/16 \

--query Vpc.VpcId --output text)

$ echo "$vpc_id"

vpc-24de2d4d

$ create_vpc_output=$(aws ec2 create-vpc --cidr-block 10.0.0.0/16)

$ vpc_id=$(jp -u Vpc.VpcId <<< "$create_vpc_output“)

Page 38: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ vpc_id=$(aws ec2 create-vpc --cidr-block 10.0.0.0/16 \

--query Vpc.VpcId --output text)

$ echo "$vpc_id"

vpc-24de2d4d

$ create_vpc_output=$(aws ec2 create-vpc --cidr-block 10.0.0.0/16)

$ vpc_id=$(jp -u Vpc.VpcId <<< "$create_vpc_output")

$ echo "$vpc_id"

vpc-24de2d4d

Page 39: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ vpc_id=$(aws ec2 create-vpc --cidr-block 10.0.0.0/16 \

--query Vpc.VpcId --output text)

$ echo "$vpc_id"

vpc-24de2d4d

$ create_vpc_output=$(aws ec2 create-vpc --cidr-block 10.0.0.0/16)

$ vpc_id=$(jp -u Vpc.VpcId <<< "$create_vpc_output")

$ echo "$vpc_id"

vpc-24de2d4d

And we can make this even better!

Page 40: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Problem Statement

Page 41: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Demo

$

Page 42: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Let’s talk about how

Page 43: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 create-vpc --cidr-block 10.0.0.0/16 --generate-cli-skeleton output

{

"Vpc": {

"VpcId": "VpcId",

"State": "State",

"CidrBlock": "CidrBlock",

"DhcpOptionsId": "DhcpOptionsId",

"Tags": [

{

"Key": "Key",

"Value": "Value"

}

],

"InstanceTenancy": "InstanceTenancy",

"IsDefault": true

}

}

Page 44: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 create-vpc --cidr-block 10.0.0.0/16 --generate-cli-skeleton output

{

"Vpc": {

"VpcId": "VpcId",

"State": "State",

"CidrBlock": "CidrBlock",

"DhcpOptionsId": "DhcpOptionsId",

"Tags": [

{

"Key": "Key",

"Value": "Value"

}

],

"InstanceTenancy": "InstanceTenancy",

"IsDefault": true

}

}

"Vpc":{"type":"structure","members":{

"VpcId":{"shape":"String"

},"State":{"shape":"VpcState"

},"CidrBlock":{"shape":"String"

},"DhcpOptionsId":{"shape":"String"

},"Tags":{"shape":"TagList"

},"InstanceTenancy":{"shape":"Tenancy"

},"IsDefault":{"shape":"Boolean"

}}

} botocore/botocore/data/ec2/2016-09-15/service-2.json

Page 45: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 create-vpc --cidr-block 10.0.0.0/16 --generate-cli-skeleton output

{

"Vpc": {

"VpcId": "VpcId",

"State": "State",

"CidrBlock": "CidrBlock",

"DhcpOptionsId": "DhcpOptionsId",

"Tags": [

{

"Key": "Key",

"Value": "Value"

}

],

"InstanceTenancy": "InstanceTenancy",

"IsDefault": true

}

}

"Vpc":{"type":"structure","members":{

"VpcId":{"shape":"String"

},"State":{"shape":"VpcState"

},"CidrBlock":{"shape":"String"

},"DhcpOptionsId":{"shape":"String"

},"Tags":{"shape":"TagList"

},"InstanceTenancy":{"shape":"Tenancy"

},"IsDefault":{"shape":"Boolean"

}}

} botocore/botocore/data/ec2/2016-09-15/service-2.json

Page 46: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 create-vpc --cidr-block 10.0.0.0/16 --generate-cli-skeleton output

{

"Vpc": {

"VpcId": "VpcId",

"State": "State",

"CidrBlock": "CidrBlock",

"DhcpOptionsId": "DhcpOptionsId",

"Tags": [

{

"Key": "Key",

"Value": "Value"

}

],

"InstanceTenancy": "InstanceTenancy",

"IsDefault": true

}

}

"Vpc":{"type":"structure","members":{

"VpcId":{"shape":"String"

},"State":{"shape":"VpcState"

},"CidrBlock":{"shape":"String"

},"DhcpOptionsId":{"shape":"String"

},"Tags":{"shape":"TagList"

},"InstanceTenancy":{"shape":"Tenancy"

},"IsDefault":{"shape":"Boolean"

}}

} botocore/botocore/data/ec2/2016-09-15/service-2.json

Page 47: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 create-vpc --cidr-block 10.0.0.0/16 --generate-cli-skeleton output

{

"Vpc": {

"VpcId": "VpcId",

"State": "State",

"CidrBlock": "CidrBlock",

"DhcpOptionsId": "DhcpOptionsId",

"Tags": [

{

"Key": "Key",

"Value": "Value"

}

],

"InstanceTenancy": "InstanceTenancy",

"IsDefault": true

}

}

"Vpc":{"type":"structure","members":{

"VpcId":{"shape":"String"

},"State":{"shape":"VpcState"

},"CidrBlock":{"shape":"String"

},"DhcpOptionsId":{"shape":"String"

},"Tags":{"shape":"TagList"

},"InstanceTenancy":{"shape":"Tenancy"

},"IsDefault":{"shape":"Boolean"

}}

} botocore/botocore/data/ec2/2016-09-15/service-2.json

Page 48: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

AWS Cloud

VPC

10.0.0.0/16

Destination Target

10.0.0.0/16 local

router

Page 49: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

VPC

10.0.0.0/16

Subnet

10.0.0.0/24

AWS Cloud

Internet

gateway

router

Destination Target

10.0.0.0/16 local

0.0.0.0/0 igw-id

Page 50: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Demo

$

Page 51: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Important Takeaways

• --generate-cli-skeleton output

• Leverage UNIX commands (e.g.

echo, history)

Page 52: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

The Effective AWS CLI User Tenets

The effective AWS CLI user:

Troubleshoots well

Page 53: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 create-security-group --group-name re:Invent \

--vpc-id VpcId

Page 54: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 create-security-group --group-name re:Invent \

--vpc-id VpcId

aws: error: argument --description is required

Page 55: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 create-security-group --group-name re:Invent \

--vpc-id VpcId

aws: error: argument --description is required

$ aws ec2 create-security-group --group-name re:Invent \

--description 're:Invent demo' --vpc-id VpcId

Page 56: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 create-security-group --group-name re:Invent \

--vpc-id VpcId

aws: error: argument --description is required

$ aws ec2 create-security-group --group-name re:Invent \

--description 're:Invent demo' --vpc-id VpcId

An error occurred (InvalidVpcID.NotFound) when calling the CreateSecurityGroup operation: The vpc ID 'VpcId' does not exist

Page 57: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

--debug

Page 58: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 create-security-group --group-name re:Invent \

--description 're:Invent demo' --vpc-id "$vpc_id” --debug

Page 59: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 create-security-group --group-name re:Invent \

--description 're:Invent demo' --vpc-id "$vpc_id” --debug

Page 60: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 create-security-group --group-name re:Invent \

--description 're:Invent demo' --vpc-id "$vpc_id" -–debug

2016-11-04 10:30:33,532 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/1.11.10 Python/2.7.10 Darwin/15.6.0 botocore/1.4.65

2016-11-04 10:30:33,533 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['ec2', 'create-security-group', '--group-name', 're:Invent', '--description', 're:Invent demo', '--vpc-id', 'vpc-43cb382a', '--debug']

2016-11-04 10:30:33,533 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_scalar_parsers at 0x10eefc488>

2016-11-04 10:30:33,533 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x10ecde578>

2016-11-04 10:30:33,533 - MainThread - botocore.credentials - DEBUG - Skipping environment variable credential check because profile name was explicitly set.

2016-11-04 10:30:33,537 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /Users/kyleknap/GitHub/botocore/botocore/data/ec2/2016-09-15/service-2.json

2016-11-04 10:30:33,622 - MainThread - botocore.hooks - DEBUG - Event service-data-loaded.ec2: calling handler <function register_retries_for_service at 0x10e904500>

Page 61: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

2016-11-04 10:30:33,623 - MainThread - botocore.handlers - DEBUG - Registering retry handlers for service: ec2

2016-11-04 10:30:33,628 - MainThread - botocore.hooks - DEBUG - Event building-command-table.ec2: calling handler <functools.partial object at 0x10ef02940>

2016-11-04 10:30:33,628 - MainThread - awscli.customizations.removals - DEBUG -Removing operation: import-instance

2016-11-04 10:30:33,628 - MainThread - awscli.customizations.removals - DEBUG -Removing operation: import-volume

2016-11-04 10:30:33,628 - MainThread - botocore.hooks - DEBUG - Event building-command-table.ec2: calling handler <function add_waiters at 0x10ef03578>

2016-11-04 10:30:33,631 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /Users/kyleknap/GitHub/botocore/botocore/data/ec2/2016-09-15/waiters-2.json

2016-11-04 10:30:33,635 - MainThread - awscli.clidriver - DEBUG - OrderedDict([(u'dry-run', <awscli.arguments.BooleanArgument object at 0x10febe950>), (u'no-dry-run', <awscli.arguments.BooleanArgument object at 0x10febe990>), (u'group-name', <awscli.arguments.CLIArgument object at 0x10febe9d0>), (u'description', <awscli.arguments.CLIArgument object at 0x10febea10>), (u'vpc-id', <awscli.arguments.CLIArgument object at 0x10febea50>)])

Page 62: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

2016-11-04 10:30:33,623 - MainThread - botocore.handlers - DEBUG - Registering retry handlers for service: ec2

2016-11-04 10:30:33,628 - MainThread - botocore.hooks - DEBUG - Event building-command-table.ec2: calling handler <functools.partial object at 0x10ef02940>

2016-11-04 10:30:33,628 - MainThread - awscli.customizations.removals - DEBUG -Removing operation: import-instance

2016-11-04 10:30:33,628 - MainThread - awscli.customizations.removals - DEBUG -Removing operation: import-volume

2016-11-04 10:30:33,628 - MainThread - botocore.hooks - DEBUG - Event building-command-table.ec2: calling handler <function add_waiters at 0x10ef03578>

2016-11-04 10:30:33,631 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /Users/kyleknap/GitHub/botocore/botocore/data/ec2/2016-09-15/waiters-2.json

2016-11-04 10:30:33,635 - MainThread - awscli.clidriver - DEBUG - OrderedDict([(u'dry-run', <awscli.arguments.BooleanArgument object at 0x10febe950>), (u'no-dry-run', <awscli.arguments.BooleanArgument object at 0x10febe990>), (u'group-name', <awscli.arguments.CLIArgument object at 0x10febe9d0>), (u'description', <awscli.arguments.CLIArgument object at 0x10febea10>), (u'vpc-id', <awscli.arguments.CLIArgument object at 0x10febea50>)])

And this continues on for a while…

Page 63: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command$ aws ec2 create-security-group \

--group-name re:Invent \--description 're:Invent demo' \--vpc-id vpc-24de2d4d \--query GroupId --output text

Page 64: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

botocore client call

# Python coderesponse = ec2_client.create_security_group(

GroupName=‘re:Invent’,Description=‘re:Invent demo’,VpcId=‘vpc-24de2d4d’

)

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id vpc-24de2d4d \--query GroupId --output text

Page 65: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

botocore client call

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id vpc-24de2d4d \--query GroupId --output text

# Python coderesponse = ec2_client.create_security_group(

GroupName=‘re:Invent’,Description=‘re:Invent demo’,VpcId=‘vpc-24de2d4d’

)

Page 66: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

botocore client call

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id vpc-24de2d4d \--query GroupId --output text

# Python coderesponse = ec2_client.create_security_group(

GroupName=‘re:Invent’,Description=‘re:Invent demo’,VpcId=‘vpc-24de2d4d’

)

Page 67: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

botocore client call

sg-1d032e64

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id vpc-24de2d4d \--query GroupId --output text

# Python coderesponse = ec2_client.create_security_group(

GroupName=‘re:Invent’,Description=‘re:Invent demo’,VpcId=‘vpc-24de2d4d’

)

Page 68: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

botocore client call

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id vpc-24de2d4d \--query GroupId --output text

# Python coderesponse = ec2_client.create_security_group(

GroupName=‘re:Invent’,Description=‘re:Invent demo’,VpcId=‘vpc-24de2d4d’

)

sg-1d032e64

Page 69: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

botocore client call

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id vpc-24de2d4d \--query GroupId --output text

# Python coderesponse = ec2_client.create_security_group(

GroupName=‘re:Invent’,Description=‘re:Invent demo’,VpcId=‘vpc-24de2d4d’

)

sg-1d032e64

Page 70: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

botocore client call

# Python coderesponse = ec2_client.create_security_group(

GroupName=‘re:Invent’,Description=‘re:Invent demo’,VpcId=‘vpc-24de2d4d’

)

Page 71: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

botocore client call

Validate/Serialize parameters

"CreateSecurityGroupRequest”{"type":"structure”,"required":["GroupName", "Description”],"members":{

"DryRun":{"shape":"Boolean”

},"GroupName":{

"shape":"String”},"Description":{

"shape":"String”},"VpcId":{

"shape":"String”}

}}

botocore/botocore/data/ec2/2016-09-15/service-2.json

Page 72: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Make botocore client call

Validate/Serialize parameters

HTTP request/response

Page 73: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Make botocore client call

Validate/Serialize parameters

HTTP request/response

Parse response

"CreateSecurityGroupResult”:{ "type":"structure”,"members":{

"GroupId":{"shape":"String”

}}

}botocore/botocore/data/ec2/2016-09-15/service-2.json

Page 74: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

--debug

Page 75: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo’ \--vpc-id "$vpc_id" -–debug

Page 76: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

awscli.clidriver - DEBUG - Arguments entered to CLI: ['ec2', 'create-security-group', '--group-name', 're:Invent’,'--description', 're:Invent demo’,'--vpc-id', 'vpc-43cb382a', '--debug']

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id "$vpc_id" -–debug

Page 77: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

awscli.clidriver - DEBUG - Arguments entered to CLI: ['ec2', 'create-security-group', '--group-name', 're:Invent’,'--description', 're:Invent demo’,'--vpc-id', 'vpc-43cb382a', '--debug']

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id "$vpc_id" -–debug

Page 78: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

awscli.clidriver - DEBUG - Arguments entered to CLI: ['ec2', 'create-security-group', '--group-name', 're:Invent’,'--description', 're:Invent demo’,'--vpc-id', 'vpc-43cb382a', '--debug']

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id "$vpc_id" -–debug

Page 79: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

$ aws ec2 create-security-group \--group-name re:Invent \--description file://description.txt \--vpc-id "$vpc_id" -–debug

Page 80: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

$ aws ec2 create-security-group \--group-name re:Invent \--description file://description.txt \--vpc-id "$vpc_id" -–debug

Page 81: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

$ aws ec2 create-security-group \--group-name re:Invent \--description file://description.txt \--vpc-id "$vpc_id" -–debug

awscli.clidriver - DEBUG - Arguments entered to CLI: ['ec2', 'create-security-group', '--group-name', 're:Invent’,'--description', 'file://description.txt’,'--vpc-id', 'vpc-43cb382a', '--debug']

Page 82: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

$ aws ec2 create-security-group \--group-name re:Invent \--description file://description.txt \--vpc-id "$vpc_id" -–debug

awscli.clidriver - DEBUG - Arguments entered to CLI: ['ec2', 'create-security-group', '--group-name', 're:Invent’,'--description', 'file://description.txt’,'--vpc-id', 'vpc-43cb382a', '--debug']

Page 83: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse responseawscli.arguments - DEBUG - Unpacked value of u're:Invent demo' for parameter "description": u're:Invent demo'

$ aws ec2 create-security-group \--group-name re:Invent \--description file://description.txt \--vpc-id "$vpc_id" -–debug

awscli.clidriver - DEBUG - Arguments entered to CLI: ['ec2', 'create-security-group', '--group-name', 're:Invent’,'--description', 'file://description.txt’,'--vpc-id', 'vpc-43cb382a', '--debug']

Page 84: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse responseawscli.arguments - DEBUG - Unpacked value of u're:Invent demo' for parameter "description": u're:Invent demo'

$ aws ec2 create-security-group \--group-name re:Invent \--description file://description.txt \--vpc-id "$vpc_id" -–debug

awscli.clidriver - DEBUG - Arguments entered to CLI: ['ec2', 'create-security-group', '--group-name', 're:Invent’,'--description', 'file://description.txt’,'--vpc-id', 'vpc-43cb382a', '--debug']

Page 85: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id "$vpc_id" -–debug

Page 86: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id "$vpc_id" -–debug

botocore.endpoint - DEBUG - Making request for OperationModel(name=CreateSecurityGroup) (verify_ssl=True) with params: {

'body': {'Action': 'CreateSecurityGroup','GroupName': 're:Invent’,'Version': '2016-09-15’,'VpcId': 'vpc-43cb382a', ‘GroupDescription': 're:Invent demo’},

‘url':'https://ec2.us-east-2.amazonaws.com/’,...}

Page 87: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id "$vpc_id" -–debug

botocore.endpoint - DEBUG - Making request for OperationModel(name=CreateSecurityGroup) (verify_ssl=True) with params: {

'body': {'Action': 'CreateSecurityGroup','GroupName': 're:Invent’,'Version': '2016-09-15’,'VpcId': 'vpc-43cb382a', ‘GroupDescription': 're:Invent demo’},

‘url':'https://ec2.us-east-2.amazonaws.com/’,...}

Page 88: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id "$vpc_id" -–debug

botocore.endpoint - DEBUG - Making request for OperationModel(name=CreateSecurityGroup) (verify_ssl=True) with params: {

'body': {'Action': 'CreateSecurityGroup','GroupName': 're:Invent’,'Version': '2016-09-15’,'VpcId': 'vpc-43cb382a', ‘GroupDescription': 're:Invent demo’},

‘url':'https://ec2.us-east-2.amazonaws.com/’,...}

Page 89: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id "$vpc_id" -–debug

botocore.endpoint - DEBUG - Making request for OperationModel(name=CreateSecurityGroup) (verify_ssl=True) with params: {

'body': {'Action': 'CreateSecurityGroup','GroupName': 're:Invent’,'Version': '2016-09-15’,'VpcId': 'vpc-43cb382a', ‘GroupDescription': 're:Invent demo’},

‘url':'https://ec2.us-east-2.amazonaws.com/’,...}

Page 90: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id "$vpc_id" -–debug

botocore.vendored.requests.packages.urllib3.connectionpool - DEBUG - "POST / HTTP/1.1" 200 None

Page 91: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id "$vpc_id" -–debug

botocore.vendored.requests.packages.urllib3.connectionpool - DEBUG - "POST / HTTP/1.1" 200 None

Page 92: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id "$vpc_id" -–debug

botocore.parsers - DEBUG - Response body:<?xml version="1.0" encoding="UTF-8"?><CreateSecurityGroupResponse>

<requestId>request-id</requestId><return>true</return><groupId>sg-5ec80f37</groupId>

</CreateSecurityGroupResponse>

Page 93: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id "$vpc_id" -–debug

botocore.parsers - DEBUG - Response body:<?xml version="1.0" encoding="UTF-8"?><CreateSecurityGroupResponse>

<requestId>request-id</requestId><return>true</return><groupId>sg-5ec80f37</groupId>

</CreateSecurityGroupResponse>

Page 94: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id "$vpc_id" -–debug

botocore.parsers - DEBUG - Response body:<?xml version="1.0" encoding="UTF-8"?><CreateSecurityGroupResponse>

<requestId>request-id</requestId><return>true</return><groupId>sg-5ec80f37</groupId>

</CreateSecurityGroupResponse>

Page 95: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id "$vpc_id" -–debug

botocore.retryhandler - DEBUG - No retry needed.

botocore.parsers - DEBUG - Response body:<?xml version="1.0" encoding="UTF-8"?><CreateSecurityGroupResponse>

<requestId>request-id</requestId><return>true</return><groupId>sg-5ec80f37</groupId>

</CreateSecurityGroupResponse>

Page 96: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Parse command

Format response

Validate/Serialize parameters

HTTP request/response

Parse response

$ aws ec2 create-security-group \--group-name re:Invent \--description 're:Invent demo' \--vpc-id "$vpc_id" -–debug

botocore.retryhandler - DEBUG - No retry needed.

botocore.parsers - DEBUG - Response body:<?xml version="1.0" encoding="UTF-8"?><CreateSecurityGroupResponse>

<requestId>request-id</requestId><return>true</return><groupId>sg-5ec80f37</groupId>

</CreateSecurityGroupResponse>

Page 97: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

VPC

10.0.0.0/16

Subnet

10.0.0.0/24

AWS Cloud

Internet

gateway

router

Destination Target

10.0.0.0/16 local

0.0.0.0/0 igw-id

Page 98: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

VPC

10.0.0.0/16

Subnet

10.0.0.0/24

security group

AWS Cloud

Internet

gateway

router

Destination Target

10.0.0.0/16 local

0.0.0.0/0 igw-id

Page 99: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Demo

$

Page 100: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Important Takeaways

• --debug

• Search for Traceback’s

• Leverage knowledge of AWS CLI

architecture

Page 101: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

The Effective AWS CLI User Tenets

The effective AWS CLI user:

Is resourceful with tooling

Page 102: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

• BASH: variables, pipes, functions

Page 103: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

• BASH: variables, pipes, functions

• UNIX commands: xargs, sort, tail

Page 104: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

• BASH: variables, pipes, functions

• UNIX commands: xargs, sort, tail

• External tools: jp, jpterm, aws-shell

Page 105: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

• BASH: variables, pipes, functions

• UNIX commands: xargs, sort, tail

• External tools: jp, jpterm, aws-shell

• DIY (Do it yourself) tooling

Page 106: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

alias

Page 107: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

[alias]st = statusci = commitbr = branchco = checkout

~/.gitconfig

Page 108: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

[alias]st = statusci = commitbr = branchco = checkout

~/.gitconfig

$ git co some-branch

Page 109: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

[alias]st = statusci = commitbr = branchco = checkout

~/.gitconfig

$ git co some-branch

Page 110: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

[alias]st = statusci = commitbr = branchco = checkout

~/.gitconfig

$ git co some-branch $ git checkout some-branch

Page 111: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

VPC

10.0.0.0/16

Subnet

10.0.0.0/24

security group

AWS Cloud

Internet

gateway

router

Destination Target

10.0.0.0/16 local

0.0.0.0/0 igw-id

Page 112: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

VPC

10.0.0.0/16

Subnet

10.0.0.0/24

security group

AWS Cloud

instance

Internet

gateway

router

Destination Target

10.0.0.0/16 local

0.0.0.0/0 igw-id

role

Page 113: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Demo

$

Page 114: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Important Takeaways

• alias

• Leverage BASH and external

tooling

Page 115: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

The Effective AWS CLI User Tenets

The effective AWS CLI user:

Understands performance implications

Page 116: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Performance Implications

Client-side vs. server-side filtering

Pagination

aws s3 cp

Page 117: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Performance Implications

Client-side vs. server-side filtering

Page 118: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 describe-images \

--query 'Images[?starts_with(to_string(Name),`amzn-ami-hvm-`)]'

Page 119: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 describe-images \

--query 'Images[?starts_with(to_string(Name),`amzn-ami-hvm-`)]'

Page 120: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 describe-images \

--query 'Images[?starts_with(to_string(Name),`amzn-ami-hvm-`)]'

Page 121: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 describe-images \

--query 'Images[?starts_with(to_string(Name),`amzn-ami-hvm-`)]'

$ aws ec2 describe-images \--filters Name=name,Values='amzn-ami-hvm-*' --query 'Images'

Page 122: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 describe-images \

--query 'Images[?starts_with(to_string(Name),`amzn-ami-hvm-`)]'

$ aws ec2 describe-images \--filters Name=name,Values='amzn-ami-hvm-*' --query 'Images'

Page 123: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 describe-images \

--query 'Images[?starts_with(to_string(Name),`amzn-ami-hvm-`)]'

$ aws ec2 describe-images \--filters Name=name,Values='amzn-ami-hvm-*' --query 'Images'

Page 124: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Performance Implications

Pagination

Page 125: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 describe-snapshots

Page 126: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 describe-snapshots

{"Snapshots”: [{"SnapshotId": "snap-0",...

},...

]} }

Page 127: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 describe-snapshots

{"Snapshots”: [{"SnapshotId": "snap-0",...

},...

]} }

{"Snapshots”: [{"SnapshotId": "snap-1000",...

},...

]} }

Page 128: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 describe-snapshots

{"Snapshots”: [{"SnapshotId": "snap-0",...

},...

]} }

{"Snapshots”: [{"SnapshotId": "snap-1000",...

},...

]} }

{"Snapshots”: [{"SnapshotId": "snap-2000",...

},...

]} }

Page 129: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 describe-snapshots

{"Snapshots”: [{"SnapshotId": "snap-0",...

},...

]} }

{"Snapshots”: [{"SnapshotId": "snap-1000",...

},...

]} }

{"Snapshots”: [{"SnapshotId": "snap-2000",...

},...

]} }

{"Snapshots”: [{"SnapshotId": "snap-0",...

},...{"SnapshotId": "snap-1000",...

},...{"SnapshotId": "snap-2000",...

},...

]} }

Page 130: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 describe-snapshots --output text --query 'Snapshots[].SnapshotId'

{"Snapshots”: [{"SnapshotId": "snap-0",...

},...

]} }

{"Snapshots”: [{"SnapshotId": "snap-1000",...

},...

]} }

{"Snapshots”: [{"SnapshotId": "snap-2000",...

},...

]} }

Page 131: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

$ aws ec2 describe-snapshots --output text --query 'Snapshots[].SnapshotId'

{"Snapshots”: [{"SnapshotId": "snap-0",...

},...

]} }

{"Snapshots”: [{"SnapshotId": "snap-1000",...

},...

]} }

{"Snapshots”: [{"SnapshotId": "snap-2000",...

},...

]} }

Page 132: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

{"Snapshots”: [{"SnapshotId": "snap-0",...

},...

]} }

{"Snapshots”: [{"SnapshotId": "snap-1000",...

},...

]} }

{"Snapshots”: [{"SnapshotId": "snap-2000",...

},...

]} }

$ aws ec2 describe-snapshots --output text --query 'Snapshots[].SnapshotId'

snap-0...

snap-1000...

snap-2000...}

Page 133: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Performance Implications

aws s3 cp

Page 134: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

upload

Thread pool

Thread

1

Thread

2

Thread

3

Page 135: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

upload

Thread pool

6 5 4 3 2 1

Thread

1

Thread

2

Thread

3

Parts

Page 136: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

upload

Thread pool

6 5 4

3

2

1Thread

1

Thread

2

Thread

3

Parts

Page 137: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

upload

Thread pool

6 5

3

4

1Thread

1

Thread

2

Thread

3

Parts

Page 138: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

upload

Thread pool

6

5

4

1Thread

1

Thread

2

Thread

3

Parts

Page 139: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

upload

Thread pool

5

4

6Thread

1

Thread

2

Thread

3

Page 140: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

upload

Thread pool

Thread

1

Thread

2

Thread

3

Page 141: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

[default]region = us-east-1

~/.aws/config

Page 142: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

[default]region = us-east-1s3 =

max_concurrent_requests = 20multipart_chunksize = 16MBmultipart_threshold = 64MBmax_queue_size = 10000

~/.aws/config

Page 143: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

[default]region = us-east-1s3 =

max_concurrent_requests = 20multipart_chunksize = 16MBmultipart_threshold = 64MBmax_queue_size = 10000

~/.aws/config

Page 144: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

max_concurrent_requests

Thread pool

6 5 4 3 2 1

Thread

1

Thread

2

Thread

3

Parts

Page 145: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

VPC

10.0.0.0/16

Subnet

10.0.0.0/24

security group

AWS Cloud

instance

Internet

gateway

router

Destination Target

10.0.0.0/16 local

0.0.0.0/0 igw-id

role

Page 146: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

VPC

10.0.0.0/16

Subnet

10.0.0.0/24

security group

AWS cloud

instance

Internet

gateway

router

Amazon

S3

Destination Target

10.0.0.0/16 local

0.0.0.0/0 igw-id

role

Page 147: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Demo

$

Page 148: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Important Takeaways

• Use server-side filtering when

possible

• Pagination with --output text

• s3 configuration options

Page 149: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

The Effective AWS CLI User Tenets

The effective AWS CLI user:

Page 150: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

The Effective AWS CLI User Tenets

The effective AWS CLI user:

Uses an iterative workflow

Example: --generate-cli-skeleton output

Page 151: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

The Effective AWS CLI User Tenets

The effective AWS CLI user:

Troubleshoots well

Example: --debug

Page 152: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

The Effective AWS CLI User Tenets

The effective AWS CLI user:

Is resourceful with tooling

Example: alias

Page 153: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

The Effective AWS CLI User Tenets

The effective AWS CLI user:

Understands performance implications

Example: s3 configurations

Page 154: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Remember to complete

your evaluations!

Page 155: AWS re:Invent 2016: The Effective AWS CLI User (DEV402)

Thank you!