AWS IAM Flashcards
What are the main logical components of AWS IAM?
Users, Groups, Roles, Permission Policies
Can a user assume a role in another account?
Yes, a user can assume a role in another account by calling assume-role using the CLI or using the Web console switch role function. With the CLI asume-role requires an –role-arn and a –role-service-name.
How can I enable a user from another account access to a resource in my account?
We will create a cross-account role the other account user will assume. The other account user will have to have a policy stating they can assume this role, for this you will need and ARN.
With an AWS IAM role can I have credentials for 30day?
No, the access keys expire from 15min to 12hrs depending on your configuration?
I have an application running on an EC2 instance, the EC2 instance has been given a role that enables access to S3, where can i get these access keys from?
You can get the keys from the metadata service 169.254.169.254.
I have a user in aws account A and what to give this user access to aws account b, how can i do this?
Create a cross-account role and user switch role in the user account.
I want to use a Web Identity Provider with my mobile application to access DynamoDB, how would this work?
Mobile app signs into IP
IP give mobile app a token
Mobile calls AsumeRoleWithEebIdentity with STS
STS validates token with IP
STS cheeks policy with AWS IAM
STS return security creds (temp access key and secret key) to mobile app
What are the creds returned by STS?
Access key and secret key
From an IAM perspective, what should I do with the root user first thing after setting up a new account?
- Remove the access key.
- Set an extremely secure password on the root user.
- Do not use the root password only;y in emergencies
- Enable MFA and lock away the security key.
From an IAM perspective is it better to assign permissions to individuals or groups?
Groups, they are easier to manage than the individual.
When assigning access to users, should I assign all access to all service to make it easy to manage and save time?
NO, you should implement the least privilege and only assign the levels of access required for the person to do their job.
As IAM best practice what should I do for passwords?
Implement a password policy for rotation and strength, reuse, etc.
When an application on an EC2 instance wants access to services in AWS, what is best practice?
Implement a role and assign to EC2 instance, only assign the service and actions required by the application.
If I have two accounts, do I share security creds between accounts?
No, you set up a role in other account and enable the user to assume the role.
For an AWS account, what are the 3 domains?
- Authentication (IAM)
- Billing
- The authorisation (Permissions)
How can we restrict the blast radius in AWS?
You cna use an AWS account, the account is the billing, user authenticationa nd authorision.
What are the two wats a user can authenticate them self with AWS IAM?
- User name & Password
- Access key & Secret key
How is a user given access to resources?
A user is given access through the assignment of policies to the user direct to the group the user is in.
What are the main parts of a user policy?
- Effect: This is allow or deny
- Action: s3:ListBucket”, Resource: “arn:aws:s3:::example_bucket
- Condation
For a user based policy, what is its main purpose?
To allow or deny user access to a resource?
For a resource-based policy, what is the main purpose?
To allow or deny one or more users to the resource?
What are the main elements of a resource-based policy?
- Effect: This is allow or deny
- Action: s3:ListBucket”, Resource: “arn:aws:s3:::example_bucket
- Principal : {“AWS”: [“arn:aws:iam::ACCOUNT-ID-WITHOUT-HYPHENS:root”]},
- Condation
What is an AWS group?
It is an admin construct to group users into a single pool.
What is an inline policy?
It is a policy thet is directly attached to a user or a group.
Can you log in as a group?
No, a group is a logical construct.
What you create a user in AWS do they have any rights by default?
No
They is a DENY in a user policy, but there is also a ALLOW for the resource, what is the out come?
Deny
What is the limit of the number of users per AWS account?
5K, but using federation you can get around this.
Using a user policy, how would you enable access for s3 resource.
“Effect”: “Allow”
“Action”: “s3:”
“Resource”: “”
How are policies evaluated when you access a resource?
All policies are gathered to gether and evaluated as a group, this includes use and resource, if there is a DENY in th epolicies, then you will be delied access, if there is no allow in the policy you will be denyed access.
Can a user have multipal policies attached?
Yes.
Can you have multipal statement in a access policy?
Yes
If I have a policy with two statements thet allow s3 access for all APIs, will I be able to access Ec2? and why?
No, as ther is a implicit deny
What are managed policies?
They are the native policies available to you by AWS that are managed by AWS.
What is a customer managed policy?
They are policies you create.
What is a condition on a policy statement?
It means the statement applies to provide the condition matches.
What are policy variables?
They are AWS variables that are available when creating policy documents.
I only want a bucket available between 1pm and 4pm daily, how can I achieve this?
You can set a condition in the policy.
Can I log into a role?
No, a role can be assumed by the users.
Can an Ec2 instance assume a role?
Yes, this way the EC2 instance can use the assumed role to access something s3.
I want a lambda function to access an s3 bucket, do I need a user
You need to assume a role that has a policy with permission to access the s3 bucket. There will also need it trust policy to allow the lamb to assume the role.
A role has two main parts, what are they?
- Trust relationship, a policy.
- Permissions, a policy