Jan 14, 2022

Start and Stop AWS EC2 Instances Based on Matching Tags

0
0
{{ }} Substitute variables

Adjust the variable values according to your preference.

Policy Code

1{
2    "Version": "2012-10-17",
3    "Statement": {
4        "Effect": "Allow",
5        "Action": [
6            "ec2:startInstances",
7            "ec2:stopInstances"
8        ],
9        "Resource": "*",
10        "Condition": {"StringEquals": 
11            {"aws:ResourceTag/{{tagName}}":"${aws:PrincipalTag/{{tagName}}}"}}
12    }
13}
DOC

Replace {{tagName}} with the name of the tag you wish to match.

    Get the IAM Pulse Check Newsletter

    We send out a periodic newsletter full of tips & tricks, contributions from the community, commentary on the industry, relevant social posts, and more.

    Checkout past issues for a sampling of the goods.