CLI, SDK and IAM Policies Flashcards
In the AWS CLI, how to check if we have access for a spefic command?
Some command supports Dry Runs with the option –dry-run
How can you decode the error messages, what you got in CLI?
Use the sts-decode-authorization-message. NOTE: it needs some permission
How can an EC2 instance get information about themself?
With the EC2 Insntance Metadata.
It doesn’t need any IAM role
The url is http://169.254.169.254/latest/meta-data
But it can’t retrive the attached policies.
Can you use the MFA with CLI?
Yes, you must create a temp. session
How to use MFA with CLI?
To get a temporary session, use the sts get-session-token command with the –serial-number of the mfa device and the –token-code that was generated by the device.
What SDK is used for the AWS CLI?
The Python version of the AWS SDK.
What are the 2 limit types for AWS CLI / SDK?
- API Rate Limit
- Service Quotas
What is API Rate Limit for AWS
- DescribeInstances API for EC2 has a limit of 100 calls per seconds
- GetObject on S3 has a limit of 5500 GET per second per prefix
- For Intermittent Errors: implement Exponential Backoff
- For Consistent Errors: request an API throttling limit increase
What is Service Quotas?
- Running On-Demand Standard Instances: 1152 vCPU
- You can request a service limit increase by opening a ticket
- You can request a service quota increase by using the Service Quotas API
What is Exponential Backoff for any AWS Service?
- If you get ThrottlingException intermittently, use exponential backoff
- Must implement yourself if using the AWS API as-is or in specific cases
- Must only implement the retries on 5xx server errors and throttling
- Do not implement on the 4xx client errors
What is the AWS CLI Credential Provider Chain order?
- CMD op
- Env. var.
- CLI cred file
- CLI config file
- Container cred
- Instance profile
What is the AWS SDK Credential Provider Chain order?
- SDK sys prop
- Env. var.
- Defaul cred profiles
- Container cred
- Instance profile
What is the auth method for AWS services on HTTP?
Signing request with SigV4.
How can you pass the SigV4 values?
- In HTTP headers
- In query string