{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "TeamcityAgent",
            "Effect": "Allow",
            "Action": [
                "ec2:Describe*",
                "ec2:StartInstances",
                "ec2:StopInstances",
                "ec2:TerminateInstances",
                "ec2:RebootInstances",
                "ec2:RunInstances",
                "ec2:ModifyInstanceAttribute",
                "ec2:*Tags"
            ],
            "Resource": "*"
        },
        {
            "Sid": "SpotInstances",
            "Effect": "Allow",
            "Action": [
                "ec2:RequestSpotInstances",
                "ec2:CancelSpotInstanceRequests"
            ],
            "Resource": "*"
        },
        {
            "Sid": "SpotFleets",
            "Effect": "Allow",
            "Action": [
                "ec2:RequestSpotFleet",
                "ec2:DescribeSpotFleetRequests",
                "ec2:CancelSpotFleetRequests"
            ],
            "Resource": "*"
        },
        {
            "Sid": "InstanceIamRoles",
            "Effect": "Allow",
            "Action": [
                "iam:PassRole",
                "iam:ListInstanceProfiles"
            ],
            "Resource": "*"
        },
        {
            "Sid": "EncryptedEbs",
            "Effect": "Allow",
            "Action": [
                "kms:CreateGrant",
                "kms:Decrypt",
                "kms:DescribeKey",
                "kms:GenerateDataKeyWithoutPlaintext",
                "kms:ReEncryptFrom",
                "kms:ReEncryptTo"
            ],
            "Resource": "*"
        }
    ]
}