概念
Resource-based policies
A policy attached to the resource that names who may use it, including other accounts and services.
このレッスンはまだ翻訳されていないため、英語で表示しています。
Same account
- Identity policy or resource policy
Another account
- Both: resource policy and caller’s identity policy
An AWS service calls in
- Resource policy with a service principal
| Case | Who must allow |
|---|---|
| Same account | Identity policy or resource policy |
| Another account | Both: resource policy and caller’s identity policy |
| An AWS service calls in | Resource policy with a service principal |
- Policy
- Bucket policy
- Typical use
- Cross-account access, force HTTPS
- Policy
- Key policy
- Typical use
- Who may use the key
- Policy
- Queue policy
- Typical use
- Let SNS or another account send
- Policy
- Topic policy
- Typical use
- Let S3 events or another account publish
- Policy
- Function policy
- Typical use
- Let S3 or API Gateway invoke
- Policy
- Secret policy
- Typical use
- Share a secret across accounts
| Service | Policy | Typical use |
|---|---|---|
| Bucket policy | Cross-account access, force HTTPS | |
| Key policy | Who may use the key | |
| Queue policy | Let SNS or another account send | |
| Topic policy | Let S3 events or another account publish | |
| Function policy | Let S3 or API Gateway invoke | |
| Secret policy | Share a secret across accounts |
1 / 2
2 / 2
- Policy
- Topic policy
- Typical use
- Let S3 events or another account publish
- Policy
- Function policy
- Typical use
- Let S3 or API Gateway invoke
- Policy
- Secret policy
- Typical use
- Share a secret across accounts
| Service | Policy | Typical use |
|---|---|---|
| Topic policy | Let S3 events or another account publish | |
| Function policy | Let S3 or API Gateway invoke | |
| Secret policy | Share a secret across accounts |
概要
A resource-based policy sits on the resource and has a Principal element. Many services support one: Amazon S3 bucket policies, AWS KMS key policies, Amazon SQS queue policies, Amazon SNS topic policies, AWS Lambda function policies, Amazon ECR repository policies, AWS Secrets Manager secret policies and VPC endpoint policies. An IAM role’s trust policy is also a resource-based policy.
Inside one account, an Allow in the identity policy or the resource policy is enough. Across accounts, both must allow: the resource policy in the owner account and an identity policy in the caller’s account.
概要
A resource policy is often simpler than a role. The caller keeps its own permissions, so one call can read a bucket in another account and write to its own. With an assumed role, the caller gives up its own permissions for the session. Services use resource policies too: a Lambda function policy lets Amazon S3 invoke the function.
覚えること
- The Principal element names who gets access: accounts, roles, users or service principals.
- KMS keys always need a key policy. IAM alone cannot grant access to a key.
- Same account: one Allow is enough. Cross account: both sides must allow.
- A resource policy lets a caller keep its own permissions. An assumed role replaces them.
覚えること
- A VPC endpoint policy limits what can pass through that endpoint.
- Use a service principal so a service such as S3 can call Lambda or SQS.
試験では
- “Let another account put messages in a queue with the least setup” points to an SQS queue policy.
- “S3 must invoke a Lambda function” points to a function resource-based policy for the S3 service principal.
- “Copy objects between buckets in two accounts and keep using the caller’s own permissions” points to bucket policies, not role switching.
混同しやすいもの
- Policy evaluation and conditionsThe order AWS checks policies in, and the condition keys that narrow an Allow.
- STS, role switching and cross-account accessAWS STS hands out temporary credentials when a trusted identity assumes a role.
AWS Key Management Service (AWS KMS)Who may use a key, which key type, how keys rotate and delete, and where KMS limits you.
このタスクの内容 · 1.1
- Shared responsibility model
- Root user and MFA
- Users, groups and roles: authorization model
- Policy evaluation and conditions
- Least privilege in practice
- STS, role switching and cross-account access
- Resource-based policies
- Service control policies
Organizations
Control Tower
IAM Identity Center
- Federating identities into IAM
Directory Service
RAM
- Regions and AZs as the HA building block
- Placing resources