Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
6
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

Organization

[AWS][EC2]特定のタグがついたEC2インスタンスのみに対して操作を許可する設定

ひとまずメモとして置いておきます。

特定のタグがついたEC2インスタンスにのみ以下の操作を許可するポリシーです。

  • インスタンスの再起動
  • インスタンスの開始
  • インスタンスの終了
policy.json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "xxxxxxxxxxxxxxxxx",
            "Effect": "Allow",
            "Action": [
                "ec2:RebootInstances",
                "ec2:StartInstances",
                "ec2:StopInstances"
            ],
            "Condition": {
                "StringEquals": {
                    "ec2:ResourceTag/[:tagName]": "[:value]"
                }
            },
            "Resource": [
                "*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "ec2:Describe*"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

[:tagName]を指定するタグ名に、[:value]を指定する値に置き換えればOK。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
6
Help us understand the problem. What are the problem?