-
Notifications
You must be signed in to change notification settings - Fork 59
/
partner-account.yaml
33 lines (32 loc) · 1.13 KB
/
partner-account.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
AWSTemplateFormatVersion: 2010-09-09
Description: Creates a role that can be used to publish messages to AWS IoT Core that can be assumed by an EC2 instance
Parameters:
CustomerAccountParameter:
Type: String
Description: Enter the account ID of the customer account
Resources:
PublishToCustomerRole:
Type: AWS::IAM::Role
Properties:
RoleName: !Join [ "", [ "publish-to-customer-role-", !Ref CustomerAccountParameter ] ]
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action: sts:AssumeRole
Principal:
Service: ec2.amazonaws.com
Policies:
- PolicyName: root
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- sts:AssumeRole
Resource: !Join [ "", [ "arn:aws:iam::", !Ref CustomerAccountParameter, ":role/publish-from-partner-role-", !Ref "AWS::AccountId" ] ]
PublishToCustomerInstanceProfile:
Type: AWS::IAM::InstanceProfile
Properties:
Roles:
- !Ref PublishToCustomerRole