Skip to content

Instantly share code, notes, and snippets.

@gabanox
Created October 1, 2021 12:18
Show Gist options
  • Save gabanox/b43f19761e1491055cc94ff9883c5a6c to your computer and use it in GitHub Desktop.
Save gabanox/b43f19761e1491055cc94ff9883c5a6c to your computer and use it in GitHub Desktop.
Resources:
SSMInstanceRole:
Type: "AWS::IAM::Role"
Properties:
RoleName: !Sub "SystemsManagerRole-${AWS::AccountId}"
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- ec2.amazonaws.com
- ssm.amazonaws.com
Action:
- 'sts:AssumeRole'
Description: "A SSM role for use by EC2 Instances to be managed."
ManagedPolicyArns: [
"arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore",
"arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforSSM",
"arn:aws:iam::aws:policy/AmazonSSMFullAccess",
"arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess"
]
SSMInstanceProfile:
Type: "AWS::IAM::InstanceProfile"
Properties:
InstanceProfileName: !Sub "SystemsManagerInstanceRole-${AWS::AccountId}"
Roles:
- !Ref SSMInstanceRole
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment