5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Continuous Updating]IAM権限まわりの勉強用メモ

Last updated at Posted at 2016-10-03

はじめに

 AWS社内利用において、AWSセキュリティ管理統制の業務に携わっています。
 しかし、IAMの権限まわりについて、いまいちよく理解できておらず、ユーザ部門のやりたいことと必要なIAM権限をマッピングできていないので、ユーザ部門からの問い合わせ対応に少し困っています。
 余談(グチ)になりますが、時々ベンダーからユーザ部門経由で、「こんなことやりたいので、必要な権限をください」的なメールが届きますが、AWSを使ってシステムを構築していますから、IAM権限くらいは自分で調べてから連絡しろよと言いたくなります......が、自分もちゃんと理解できていないので、人のことを言えません。
 ですので、この記事をIAM権限まわりの勉強用メモとして、継続的にアップデートしていこうと思っています。

やりたいことリスト

ELB証明書操作の権限

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "iam:*ServerCertificate",
                "iam:*ServerCertificates"
            ],
            "Resource": "*"
        }
    ]
}
Action 内容
iam:DeleteServerCertificate
iam:GetServerCertificate
iam:UpdateServerCertificate
iam:UploadServerCertificate
iam:ListServerCertificates

EC2にロールを設定する権限

AWSマネコンでEC2ロールを設定する場合

{
  "Version": "2012-10-17",
  "Statement": [
  {
    "Effect": "Allow",
    "Action": [
      "iam:PassRole",
      "iam:ListInstanceProfiles",
      "ec2:*"
    ],
    "Resource": "*"
   }
 ]
}
Action 内容
iam:PassRole IAMロールをIAMユーザ以外のものに渡す(詳細を確認中)
iam:ListInstanceProfiles すべてのロールの表示をユーザーに許可

Tagで特定のEC2 Instancesの保護

保護対象EC2 Instancesの停止、再起動、削除を禁止します。
また、保護手段であるTagの削除も禁止します。

※特定のVPCやSubnet内のEC2 Instancesの保護について、
【Amazon EC2 API アクションでサポートされるリソースレベルのアクセス許可】により、インスタンスの起動(StartInstances)、停止(StopInstances)、削除(TerminateInstances)、再起動(RebootInstances)(作成(RunInstances)を除く)のAPI Actionはリソースベースのアクセス許可をサポートされていないため、Tagで特定のEC2 Instancesを保護することにしました。

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "ProtectedEc2Instances",
            "Effect": "Deny",
            "Action": [
                "ec2:StopInstances",
                "ec2:RebootInstances",
                "ec2:TerminateInstances",
                "ec2:DeleteTags"
            ],
            "Condition": {
                "StringEquals": {
                    "ec2:ResourceTag/tag-key": "value"
                }
            },
            "Resource": "arn:aws:ec2:region:account:instance/*"
        }
    ]
}
5
5
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
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?