Skip to content

Commit 29f6c76

Browse files
author
Bob Strahan
committed
Add IAM permissions boundary support to CloudFormation templates
1 parent a83b5c4 commit 29f6c76

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

patterns/pattern-3/sagemaker_classifier_endpoint.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,25 @@ Parameters:
6161
Default: 60
6262
MinValue: 0
6363

64+
PermissionsBoundaryArn:
65+
Type: String
66+
Default: ""
67+
Description: >-
68+
(Optional) ARN of an existing IAM Permissions Boundary policy to attach to all IAM roles.
69+
Required by some organizations with Service Control Policies (SCPs).
70+
Format: arn:aws:iam::account-id:policy/policy-name
71+
Leave blank if no Permissions Boundary is required.
72+
AllowedPattern: "^(|arn:aws:iam::[0-9]{12}:policy/.+)$"
73+
ConstraintDescription: Must be empty or a valid IAM policy ARN
74+
75+
Conditions:
76+
HasPermissionsBoundary: !Not [!Equals [!Ref PermissionsBoundaryArn, ""]]
77+
6478
Resources:
6579
UDOPExecutionRole:
6680
Type: AWS::IAM::Role
6781
Properties:
82+
PermissionsBoundary: !If [HasPermissionsBoundary, !Ref PermissionsBoundaryArn, !Ref AWS::NoValue]
6883
AssumeRolePolicyDocument:
6984
Version: '2012-10-17'
7085
Statement:
@@ -176,4 +191,4 @@ Outputs:
176191

177192
ModelName:
178193
Description: Name of the created SageMaker model
179-
Value: !GetAtt UDOPModel.ModelName
194+
Value: !GetAtt UDOPModel.ModelName

patterns/pattern-3/template.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ Resources:
128128
UDOPModelArtifactPath: !Ref UDOPModelArtifactPath
129129
S3Bucket: !Ref OutputBucket
130130
CustomerManagedEncryptionKeyArn: !Ref CustomerManagedEncryptionKeyArn
131+
PermissionsBoundaryArn: !Ref PermissionsBoundaryArn
131132

132133
# JSON Schema which defines the structure of the pattern configuration settings
133134
# used by the UI to allow the configuration to be inspected and customized.

template.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3896,6 +3896,7 @@ Resources:
38963896
Action: sts:AssumeRole
38973897
ManagedPolicyArns:
38983898
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
3899+
PermissionsBoundary: !If [HasPermissionsBoundary, !Ref PermissionsBoundaryArn, !Ref AWS::NoValue]
38993900
Policies:
39003901
- PolicyName: SageMakerA2IAccess
39013902
PolicyDocument:
@@ -5390,6 +5391,7 @@ Resources:
53905391
Effect: Allow
53915392
Principal:
53925393
Service: codebuild.amazonaws.com
5394+
PermissionsBoundary: !If [HasPermissionsBoundary, !Ref PermissionsBoundaryArn, !Ref AWS::NoValue]
53935395
Policies:
53945396
- PolicyName: ecs-service
53955397
PolicyDocument:
@@ -5535,6 +5537,7 @@ Resources:
55355537
Action:
55365538
- sts:AssumeRole
55375539
Path: "/"
5540+
PermissionsBoundary: !If [HasPermissionsBoundary, !Ref PermissionsBoundaryArn, !Ref AWS::NoValue]
55385541
Policies:
55395542
- PolicyName: root
55405543
PolicyDocument:

0 commit comments

Comments
 (0)