0
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.

タグを使用してアクセス制御をする

Posted at

以下の例では、naata-web1a というNameタグのみ停止、終了だけできるように設定してみます。

IAMポリシーを以下のように設定し、IAMユーザーへアタッチしてみる。

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "ec2:describe*"
            ],
            "Sid": "1",
            "Resource": [
                "*"
            ],
            "Effect": "Allow"
        },
        {
            "Action": [
                "ec2:StopInstances",
                "ec2:TerminateInstances"
            ],
            "Sid": "2",
            "Condition": {
                "StringEquals": {
                    "ec2:ResourceTag/Name": "naata-web1a"
                }
            },
            "Resource": [
                "*"
            ],
            "Effect": "Allow"
        }
    ]
}

naata-web1a を停止してみる。→これはうまくいくはず。

naata-web1a を起動してみる。→これはうまくいかないはず。
image.png

naata-web1cを起動してみる。→これもうまくいかない。
image.png

AWSのページには、他にも例があります、参考に。
タグを使用したアクセス制御
IAM タグを使用したアクセス制御
EC2 インスタンスや EBS ボリュームの作成方法を、IAM ポリシーのタグを使用して制限する方法

0
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
0
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?