ladderlore
ガイドをリクエスト
  • S3 や IAM などのサービス名を入力してください。

概念

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
Which policy must allow, by case.
  • S3

    Policy
    Bucket policy
    Typical use
    Cross-account access, force HTTPS
  • KMS

    Policy
    Key policy
    Typical use
    Who may use the key
  • SQS

    Policy
    Queue policy
    Typical use
    Let SNS or another account send
  • SNS

    Policy
    Topic policy
    Typical use
    Let S3 events or another account publish
  • Lambda

    Policy
    Function policy
    Typical use
    Let S3 or API Gateway invoke
  • Secrets Manager

    Policy
    Secret policy
    Typical use
    Share a secret across accounts
Services that take resource-based policies.

1 / 2

  • S3

    Policy
    Bucket policy
    Typical use
    Cross-account access, force HTTPS
  • KMS

    Policy
    Key policy
    Typical use
    Who may use the key
  • SQS

    Policy
    Queue policy
    Typical use
    Let SNS or another account send

2 / 2

  • SNS

    Policy
    Topic policy
    Typical use
    Let S3 events or another account publish
  • Lambda

    Policy
    Function policy
    Typical use
    Let S3 or API Gateway invoke
  • Secrets Manager

    Policy
    Secret policy
    Typical use
    Share a secret across accounts
Services that take resource-based policies.

概要

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.