AWS CLI Flashcards

1
Q

Paginating results from S3/Dynamo. you want to show100 results per page to your users and minimize the number of API calls that you will use.

max-items
starting-token

page-size

A

To paginate results, you would use max-items with starting-token. This will return PAGES of data including the next token to use.

Page-Size Is about how many API calls AWS will make to pull data. It defaults to 1,000. (So to read 3500 rows, it would make 4 API calls). You might use this to reduce the amount of data read in one go if you are getting timeout errors.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

using CLI, how do you filter attributes that get returned by dynamo?

A

–projection-expression

By default, all attrivutes will be returned. To reduce cost and traffic, you can specify which attributes with Projection Expression.

aws dynamodb scan –table-name UserPosts –projection-expression “user_id, content”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

using CLI, how do you filter the ITEMS (rows) before they are returned to you ?

A

Using filter-expression and expression-attribute-values

aws dynamodb scan –table-name UserPosts –filter-expression “user_id = :u” –expression-attribute-values ‘{ “:u”: {“S”:”john123”}}’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

how to assume new role with aws CLI

A

aws sts assume-role –role-arn

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

aws SQS commands with CLI

A

aws sqs list-queues
aws sqs send-message –queue-url https://sqs.eu-west-2.amazonaws.com/8681…. –message-body “Hello Steve”
aws sqs receive-message –queue-url https://sqs.eu-west-2.amazonaws.com/8681
aws sqs delete-message –queue-url xxxxxx –receipt-handle yyyyyy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Get details of current user with aws cli

A

aws sts get-caller-identity –profile besa (profile ovrrides default and picks other user)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

M

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

make lambda call with aws cli both sync and async

A

aws lambda invoke –function-name demo-lambda-python –cli-binary-format raw-in-base64-out –payload ‘{“key1”: “lilly”, “key2”: “olivia”, “key3”:”jack”}’ response.json

Asycn Call
aws lambda invoke –function-name demo-lambda-python –cli-binary-format raw-in-base64-out –payload ‘{“key1”: “lilly”, “key2”: “olivia”, “key3”:”jack”}’ –invocation-type Event response.json

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

how to monitor EC2 instance(s) using aws cli

A

aws ec2 monitor-instances –instance-ids i-1234567890abcdef0 - MOnitor ec2 instance(s)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly