Upgrade to Pro — share decks privately, control downloads, hide ads and more …

~$ aws help # Things you might not know about the AWS CLI

Ben Bridts
October 04, 2018

~$ aws help # Things you might not know about the AWS CLI

Lightning talk about the AWS CLI

Ben Bridts

October 04, 2018
Tweet

More Decks by Ben Bridts

Other Decks in Technology

Transcript

  1. cat ~/.aws/config cat ~/.aws/config [profile source] # this is 123456789012

    output = json region = eu-west-1 [profile hop] source_profile = source role_arn = arn:aws:iam::111111111111:role/user mfa_serial = arn:aws:iam::123456789012:mfa/benbridts [profile dest] source_profile = hop role_arn = arn:aws:iam::2222222222222:role/user
  2. [profile otherdest] # Environment, Ec2InstanceMetadata or EcsContainer credential_source = Ec2InstanceMetadata

    role_arn = arn:aws:iam::2222222222222:role/user external_id = foobar123
  3. --debug --debug ~$ aws iam list-users --debug [...] Arguments entered

    to CLI: ['iam', 'list-users', '--debug [...] Making request for OperationModel(name=ListUsers) (verif [...] CanonicalRequest: POST / [...] [...] Response headers: {'x-amzn-requestid': 'ef717a10-c75c-11 [...] Response body: b'<ListUsersResponse xmlns="https://iam.amazonaws.com/doc/2010 [...] {"Users": [ [...] ]}
  4. cli_follow_urlparam cli_follow_urlparam ~$ aws ssm put-parameter \ --name search --value

    https://google.com --type String An error occurred (ValidationException) when calling the PutPa operation: Value '<!doctype html>[...]</html>' at 'value' failed to satisfy constraint: Member must have length less tha equal to 4096 ~$ aws configure set cli_follow_urlparam false ~$ aws ssm put-parameter \ --name search --value https://google.com --type String { "Version": 1 }
  5. history history ~$ aws configure set cli_history enabled ~$ aws

    history list f4692e20-873c-4aa2-9a84-39048132d2f2 2018-10-05 21:15:49 PM c02cb392-39dc-4ea4-8e65-15d949f11728 2018-10-05 21:08:53 AM [...]
  6. ~$ aws history show f4692e20-873c-4aa2-9a84-39048132d2f2 AWS CLI command entered at

    time: 2018-10-05 21:15:49.803 with AWS CLI version: aws-cli/1.16.26 Python/3.6.5 Darwin/17.7 with arguments: ['ssm', 'put-parameter', '--name', 'search' , '--value', 'https://google.com', '--type', 'String']
  7. [0] API call made at time: 2018-10-05 21:15:49.901 to service:

    ssm using operation: PutParameter with parameters: { "Name": "search", "Type": "String", "Value": "https://google.com" }
  8. [0] HTTP request sent at time: 2018-10-05 21:15:49.906 to URL:

    https://ssm.eu-west-1.amazonaws.com/ with method: POST with headers: {...} with body: { "Name": "search", "Type": "String", "Value": "https://google.com" }
  9. [0] HTTP response received at time: 2018-10-05 21:15:50.303 with status

    code: 200 with headers: {...} with body: { "Version": 1 }
  10. [0] HTTP response parsed at time: 2018-10-05 21:15:50.304 parsed to:

    { "ResponseMetadata": { "HTTPHeaders": {...}, "HTTPStatusCode": 200, "RequestId": "41e12cc3-63d8-40fc-a992-73650763 }, "Version": 1 }
  11. s3 --make-it-go-fast s3 --make-it-go-fast # ~/.aws/config # https://docs.aws.amazon.com/cli/latest/topic/s3-config.html [profile example]

    s3 = max_concurrent_requests = 20 max_queue_size = 10000 multipart_threshold = 64MB multipart_chunksize = 16MB # this one can make it go slow max_bandwidth = 50MB/s # mutualy exclusive use_accelerate_endpoint = true use_dualstack_endpoint = false # ...
  12. alias alias # ~/.aws/cli/alias # https://github.com/awslabs/awscli-aliases [toplevel] whoami = sts

    get-caller-identity ~$ aws whoami { "UserId": "AIDAIXXXXXXXXXXXXXXXX", "Account": "123456789012", "Arn": "arn:aws:iam::123456789012:user/benbridts" }