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

概念

STS, role switching and cross-account access

AWS STS hands out temporary credentials when a trusted identity assumes a role.

このレッスンはまだ翻訳されていないため、英語で表示しています。

Account AAccount B
Developer
STS
Role with trust policy
S3
  1. 1The developer asks STS to assume the role in account B.
  2. 2STS checks the role’s trust policy and returns temporary credentials.
  3. 3The developer calls S3 with them. The role’s permissions policy decides what is allowed.
A cross-account role session, step by step.
  • AssumeRole

    Caller
    IAM user or role
    Typical use
    Cross-account access, role switching
  • AssumeRoleWithSAML

    Caller
    User signed in at a SAML provider
    Typical use
    Workforce federation
  • AssumeRoleWithWebIdentity

    Caller
    User signed in with OIDC
    Typical use
    App users, through Cognito
Which STS call fits which sign-in.

概要

AWS Security Token Service (AWS STS) issues temporary credentials: an access key, a secret key and a session token. You get them by assuming a role. The role has two policies. The trust policy says who may assume it. The permissions policy says what the session can do. A caller in another account also needs an identity policy that allows sts:AssumeRole.

概要

Pick the call by where the caller signed in. AssumeRole is for IAM users and roles, including cross-account access. AssumeRoleWithSAML is for users who signed in at a SAML identity provider. AssumeRoleWithWebIdentity is for users who signed in with OpenID Connect, such as a social login. For mobile apps, use Amazon Cognito instead of calling it yourself.

A session lasts one hour by default. You can set a role maximum from 1 to 12 hours. Role chaining, where one role assumes another, is capped at one hour. In the console, switching roles is the same call. When you switch, you give up your own permissions and take the role’s.

概要

When a third party acts in your account, add an external ID to the trust policy as a condition. It stops the confused deputy problem, where another customer of the same vendor tricks the vendor into using your role.

覚えること

  • Trust policy: who may assume. Permissions policy: what they can do.
  • Cross-account: a role in the target account, and an AssumeRole allow in the source account.
  • Default session 1 hour. Role maximum 1 to 12 hours. Role chaining: 1 hour at most.
  • AssumeRoleWithSAML for SAML. AssumeRoleWithWebIdentity for OIDC.

覚えること

  • External ID defends against the confused deputy problem when a vendor uses your role.
  • AWS Organizations creates OrganizationAccountAccessRole in each account it creates.

試験では

  • “Developers in account A need temporary access to a bucket in account B” points to a cross-account role with sts:AssumeRole.
  • “A third-party vendor assumes a role in our account” points to an external ID in the trust policy.
  • “A session must last longer than one hour” points to the role maximum session duration, up to 12 hours, and not role chaining.