You can use any of these as an Inline Policy for specific users or groups, or you can create this as a Managed Policy within AWS, which can be attached to users, groups and roles.
{ "Version" : "2012-10-17" , "Statement" : [ { "Action" : [ "autoscaling:Describe*" , "autoscaling:UpdateAutoScalingGroup" , "autoscaling:SuspendProcesses" , "autoscaling:ResumeProcesses" , "ec2:Describe*" , "ec2:StartInstances" , "ec2:StopInstances" , "iam:GetUser" , "rds:DescribeDBInstances" , "rds:ListTagsForResource" , "rds:StartDBInstance" , "rds:StopDBInstance", "logs:DescribeLogGroups" , "logs:DescribeLogStreams" , "logs:GetLogEvents" , "logs:TestMetricFilter" , "logs:FilterLogEvents", "cloudwatch:GetMetricStatistics" , "cloudwatch:ListMetrics" ], "Resource" : "*" , "Effect" : "Allow" } ] } |
{ "Version" : "2012-10-17" , "Statement" : [ { "Sid" : "ParkMyCloudManagement" , "Action" : [ "autoscaling:Describe*" , "autoscaling:UpdateAutoScalingGroup" , "autoscaling:SuspendProcesses" , "autoscaling:ResumeProcesses" , "ec2:Describe*" , "ec2:StartInstances" , "ec2:StopInstances" , "iam:GetUser" , "rds:DescribeDBInstances" , "rds:ListTagsForResource" , "rds:StartDBInstance" , "rds:StopDBInstance" ], "Resource" : "*" , "Effect" : "Allow" },{ "Sid" : "ParkMyCloudStartInstanceWithEncryptedBoot" , "Effect" : "Allow" , "Action" : "kms:CreateGrant" , "Resource" : "*" },{ "Sid" : "ParkMyCloudLogsAccess" , "Effect" : "Allow" , "Action" : [ "logs:DescribeLogGroups" , "logs:DescribeLogStreams" , "logs:GetLogEvents" , "logs:TestMetricFilter" , "logs:FilterLogEvents" ], "Resource" : "arn:aws:logs:*:*:*" },{ "Sid" : "ParkMyCloudCloudWatchAccess" , "Effect" : "Allow" , "Action" : [ "cloudwatch:GetMetricStatistics" , "cloudwatch:ListMetrics" ], "Resource" : "*" , "Condition" : { "Bool" : { "aws:SecureTransport" : "true" } } } ] } |
This next policy is very similar, but leverages a special tag "parkmycloud:yes" to grant permissions to park instances. (Of course you can substitute any tag key:value pair you prefer, instead.) If the instance does not have the specified tag, then the user will NOT be allowed to park the instance.
PLEASE NOTE: This tag only constrains ec2 instances. It does NOT restrict updating of autoscaling groups.
{ "Version" : "2012-10-17" , "Statement" : [{ "Sid" : "ParkMyCloudTaggedOnly" , "Action" : [ "ec2:StartInstances" , "ec2:StopInstances" ], "Condition" : { "StringEquals" : { "ec2:ResourceTag/parkmycloud" : "yes" } }, "Resource" : [ "*" ], "Effect" : "Allow" }, { "Sid" : "ParkMyCloudManagement" , "Action" : [ "autoscaling:Describe*" , "autoscaling:UpdateAutoScalingGroup" , "autoscaling:SuspendProcesses" , "autoscaling:ResumeProcesses" , "ec2:Describe*" , "iam:GetUser" , "rds:DescribeDBInstances" , "rds:ListTagsForResource" , "rds:StartDBInstance" , "rds:StopDBInstance" ], "Resource" : "*" , "Effect" : "Allow" }, { "Sid" : "ParkMyCloudStartInstanceWithEncryptedBoot" , "Effect" : "Allow" , "Action" : "kms:CreateGrant" , "Resource" : "*" }, { "Sid" : "ParkMyCloudLogsAccess" , "Effect" : "Allow" , "Action" : [ "logs:DescribeLogGroups" , "logs:DescribeLogStreams" , "logs:GetLogEvents" , "logs:TestMetricFilter" , "logs:FilterLogEvents" ], "Resource" : "arn:aws:logs:*:*:*" }, { "Sid" : "ParkMyCloudCloudWatchAccess" , "Effect" : "Allow" , "Action" : [ "cloudwatch:GetMetricStatistics" , "cloudwatch:ListMetrics" ], "Resource" : "*" , "Condition" : { "Bool" : { "aws:SecureTransport" : "true" } } } ] } |