AWS CLI, SDK, IAM Roles & Policies Flashcards
How can you test IAM policies quickly?
- Use the AWS Policy Simulator
- Use the –dry-run option in the AWS CLI
How do you decode the CLI error message when API calls fail?
Use the STS command line with the following command:
- sts decode-authorization-message
How can you access the EC2 Instance Metadata?
Use the following url:
http://169.254.169.254/latest/meta-data
How would you use MFA with the CLI?
- Create a temporary session
- Run the STS GetSessionToken API call
What is the default region used by the SDK if not specified?
us-east-1
How would you fix intermittent errors due to hitting API rate limits?
Implement Exponential Backoff Retrier
How would you fix consistent errors due to hitting API rate limits?
Request an API throttling limit increase
What is the Service Limit number for Running On-Demand Standard Instances? How could you increase this limit?
1152 vCPUs
- Request a service limit increase by opening a ticket
- Request a service quota increase by using the Service Quotas API
When would you implement Exponential Backoff, when would you not implement it, and how would you do so?
If you get ThrottlingException intermittently
- Retry mechanism already included in the SDK
- Implement retries on 5xx server errors and throttling
- Do not implement on 4xx client errors
What is the order in which the CLI looks for credentials?
- Command line options
- Environment variables - AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN
- CLI credentials file
- CLI configuration file
- Container credentials - for ECS tasks
- Instance profile credentials - for EC2 Instance profiles
What is the order in which the SDK looks for credentials?
- Java system properties - aws.accessKeyId and aws.secretKey
- Environment variables - AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
- The default credential profiles file
- Container credentials - for ECS containers
- Instance profile credentials - used on EC2 instances
What is the AWS Credentials Best Practice?
- Never store AWS Credentials in code
- Allow credentials to be inherited from the credentials chain
If you are working outside of AWS, what is best practice for using credentials?
Use env. variables / named profiles
What does SigV4 mean?
Your request to AWS are signed using your credentials and are authenticated against AWS.
- Signed using the HTTP Header option or Query String option (Query String is used when viewing S3 objects)