0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

SAML 2.0 フェデレーション用のIAMロールをCDKで作る

Posted at

(※2023-11-29に書いた個人ブログの転記です。)

概要

社内のSAML IDプロバイダーとAWSを連携して、特定のサービスにだけアクセスできるようにする。前提として、IAMに該当するSAML IDプロバイダーは作成ずみとする。

流れとしては、以下の手順が必要となる。

  1. IdP側でロールを作成する
  2. IAM で SAML プロバイダーを作成する(今回はスキップ)
  3. IAMでSAML用ロールを作成する
  4. IdPソフトウェアを設定して、SAML信頼を確立する

CDK

  1. IAMでSAML用ロールを作成する
const role = new iam.Role(this, "MySamlRole", {
      roleName: "role name",
      description:
        "description",
      assumedBy: new iam.FederatedPrincipal(
        `arn:aws:iam::********:saml-provider/*********`, // 作成したSAMLプロバイダーのarnを指定
        {
          StringEquals: {
            "SAML:aud": "https://signin.aws.amazon.com/saml"
          }
        },
        "sts:AssumeRoleWithSAML"
      )
    });

    role.addManagedPolicy() // ←ここで任意の権限を付与

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?