Skip to content

Instantly share code, notes, and snippets.

@arbabnazar
Created March 25, 2020 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arbabnazar/bc12bef11b1ccaf08432b818d02b0297 to your computer and use it in GitHub Desktop.
Save arbabnazar/bc12bef11b1ccaf08432b818d02b0297 to your computer and use it in GitHub Desktop.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ssm:DescribeSessions",
"ssm:GetConnectionStatus",
"ssm:DescribeInstanceProperties",
"ec2:DescribeInstances",
"ssm:StartSession"
],
"Resource": "*"
},
{
"Sid": "ReadAlltheSSMThings",
"Effect": "Allow",
"Action": [
"ssm:Get*",
"ssm:Describe*",
"ssm:List*"
],
"Resource": "*"
},
{
"Sid": "SameUserTerminate",
"Effect": "Allow",
"Action": "ssm:TerminateSession",
"Resource": "arn:aws:ssm:*:*:session/${aws:username}-*"
},
{
"Sid": "DenySMtoProd",
"Effect": "Deny",
"Action": "ssm:StartSession",
"Resource": [
"arn:aws:ec2:*:*:instance/*"
],
"Condition": {
"StringLike": {
"ssm:resourceTag/Environment": "Prod"
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment