Skip to content

Commit b55fc6c

Browse files
committed
Update CloudFormation service role and documentation
1 parent 9302d51 commit b55fc6c

File tree

2 files changed

+66
-64
lines changed

2 files changed

+66
-64
lines changed

iam-roles/cloudformation-management/README.md

Lines changed: 34 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,45 @@
1-
# Secure All-Patterns Deployer Role for GenAI IDP Accelerator
1+
# CloudFormation Service Role for GenAI IDP Accelerator
22

3-
This directory contains the `all-patterns-deployer-role-secure.yaml` CloudFormation template that creates a secure IAM role for deploying, managing and modifying all GenAI IDP Accelerator patterns deployments.
3+
This directory contains the `all-patterns-deployer-role-secure.yaml` CloudFormation template that creates a dedicated IAM service role for CloudFormation to deploy, manage and modify all GenAI IDP Accelerator patterns deployments.
44

55
## What This Role Does
66

7-
The **AllPatternsDeployerRole** provides comprehensive permissions to deploy, update, and manage GenAI IDP Accelerator CloudFormation stacks across all patterns (Pattern 1: BDA, Pattern 2: Textract+Bedrock, Pattern 3: Textract+UDOP+Bedrock).
7+
The **AllPatternsDeployerRole** is a CloudFormation service role that provides the necessary permissions for AWS CloudFormation to deploy, update, and manage GenAI IDP Accelerator stacks across all patterns (Pattern 1: BDA, Pattern 2: Textract+Bedrock, Pattern 3: Textract+UDOP+Bedrock). This role can only be assumed by the CloudFormation service, not by users directly.
88

99
### Key Capabilities
10-
- **Full CloudFormation Management**: Create, update, delete IDP stacks
10+
- **Full CloudFormation Management**: Create, update, delete IDP stacks - This IAM role (which CloudFormation assumes) gives necessary privileges to create/update/delete the stack which is helpful in development and sandbox environments. In production environments, admins can further limit these permissions to their discretion (e.g. disabling stack deletion).
1111
- **All Pattern Support**: Works with Pattern 1 (BDA), Pattern 2 (Textract+Bedrock), and Pattern 3 (UDOP)
1212
- **Comprehensive AWS Service Access**: All services required by IDP Accelerator
1313

1414

1515
## Security Features
1616

1717
### Region Restrictions
18-
- **Deployment Regions**: Limited to `us-east-1` and `us-west-2` only
19-
- **Cross-Region Prevention**: Denies all actions outside approved regions
20-
- **Same-Region Assumption**: Role can only be assumed in the region where it's deployed
18+
- **Same-Region Operations**: Only allows the role to be assumed in the region where the master/existing deployment stack already exists
19+
- **Cross-Region Prevention**: Denies all actions outside the deployment region
20+
- **Regional Isolation**: Ensures all operations remain within the same region as the existing IDP infrastructure
2121

2222
### Session Management
2323
- **Session Duration**: Maximum 1 hour (3600 seconds)
2424
- **Forced Re-authentication**: Requires frequent credential refresh
25+
- **Administrator Note**: Administrators must add an inline IAM policy to users wanting to deploy CloudFormation stacks with this service role, allowing them to pass the `IDP-AllPatterns-Deployer-Secure` role to the CloudFormation principal:
26+
27+
```json
28+
{
29+
"Version": "2012-10-17",
30+
"Statement": [
31+
{
32+
"Effect": "Allow",
33+
"Action": "iam:PassRole",
34+
"Resource": "arn:aws:iam::*:role/IDP-AllPatterns-Deployer-Secure"
35+
}
36+
]
37+
}
38+
```
2539

2640
### Access Control
2741
- **Account-Scoped**: Only IAM entities within the same AWS account can assume the role
28-
- **Permission-Based**: roles/users need individual `sts:AssumeRole` permissions
29-
- **CloudFormation Service**: AWS CloudFormation service can also assume the role
42+
3043

3144
## Files in this Directory
3245

@@ -36,43 +49,27 @@ The **AllPatternsDeployerRole** provides comprehensive permissions to deploy, up
3649

3750
## Parameters
3851

39-
- **MasterStackName**: Name of the master GenAI IDP stack (used in role naming)
40-
- Must follow CloudFormation stack naming pattern: `^[a-zA-Z][a-zA-Z0-9-]*$`
52+
- **ExistingIDPStackName**: Name of an existing IDP stack (must start with IDP or idp). It is assumed that the administrator has deployed the first IDP solution deployment.
53+
- Must follow CloudFormation stack naming pattern: `^[Ii][Dd][Pp][a-zA-Z0-9-]*$`
4154

4255
## Quick Start
4356

4457
1. **Deploy the IAM Role** *(Administrator Required)*:
4558
```bash
4659
aws cloudformation deploy \
47-
--template-file all-patterns-deployer-role-secure.yaml \
60+
--template-file all-patterns-deployer-role-secure.yaml \ # (Note: Ensure the template file is in your current directory or provide the full path to your template file location)
4861
--stack-name idp-deployer-role \
49-
--parameter-overrides MasterStackName=my-idp-project \
62+
--parameter-overrides ExistingIDPStackName=my-existing-idp-stack \ (the name of your existing IDP stack)
5063
--capabilities CAPABILITY_NAMED_IAM
5164
```
5265

53-
2. **Grant Assumption Permissions** (to your user/role) *(Administrator Required)* :
54-
```bash
55-
# Add this policy to your user/role
56-
{
57-
"Effect": "Allow",
58-
"Action": "sts:AssumeRole",
59-
"Resource": "arn:aws:iam::ACCOUNT:role/my-idp-project-AllPatterns-Deployer-Secure"
60-
}
61-
```
62-
63-
3. **Assume the Role**:
64-
```bash
65-
aws sts assume-role \
66-
--role-arn arn:aws:iam::123456789012:role/my-idp-project-AllPatterns-Deployer-Secure \
67-
--role-session-name idp-deployment
68-
```
69-
70-
4. **Deploy IDP Accelerator**:
66+
2. **Deploy IDP Accelerator**:
7167
```bash
72-
# Export the assumed role credentials first, then:
7368
aws cloudformation deploy \
74-
--template-file ../../template.yaml \
75-
--stack-name my-idp-stack \
69+
--template-file ../../template.yaml \ (path to your template.yaml file)
70+
--stack-name my-idp-stack \ (Name of your stack, starting with prefix IDP or idp)
71+
--role-arn arn:aws:iam::123456789012:role/All-Patterns-Deployer-Role-Secure \ (The ARN of the idp-deployer-role provided in the Output tab of the deployed role stack)
72+
--region us-east-1 \ (your selected region)
7673
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM
7774
```
7875

@@ -138,10 +135,11 @@ The role provides comprehensive access to AWS services required by all IDP patte
138135

139136
### Common Issues
140137

141-
1. **Access Denied when Assuming Role**:
142-
- Verify your user/role has `sts:AssumeRole` permission for this specific role ARN
138+
1. **Access Denied when Using Role**:
139+
- Verify your user/role has `iam:PassRole` permission for this specific role ARN
143140
- Check you're in the correct AWS region (must match role deployment region)
144141
- Ensure the role exists and is in the same account
142+
- Remember: Users cannot assume this role directly - only CloudFormation service can
145143

146144
2. **Region Restriction Errors**:
147145
- All operations must be in `us-east-1` or `us-west-2`
@@ -157,12 +155,7 @@ The role provides comprehensive access to AWS services required by all IDP patte
157155
- Ensure you're using `CAPABILITY_IAM` and `CAPABILITY_NAMED_IAM`
158156
- Check CloudWatch logs for specific service errors
159157

160-
### Getting Help
161158

162-
For additional support:
163-
1. Review the `testing-guide.md` for validation procedures
164-
2. Check the main IDP Accelerator documentation
165-
3. Consult AWS IAM best practices documentation
166159

167160
## Best Practices
168161

iam-roles/cloudformation-management/all-patterns-deployer-role-secure.yaml

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,56 @@
11
AWSTemplateFormatVersion: '2010-09-09'
2-
Description: 'Least Privileges Secure IAM role for deploying GenAI IDP patterns'
2+
Description: >
3+
This template creates a dedicated IAM Service Role for CloudFormation.
4+
This role grants permissions to create, update, and delete CloudFormation
5+
stacks and their resources. It follows the principle of least privilege
6+
by allowing only the necessary actions for stack management.
7+
This role requires an existing master/IDP stack to be already deployed
8+
as it only operates on stacks with the IDP prefix.
39
410
Parameters:
5-
MasterStackName:
11+
ExistingIDPStackName:
612
Type: String
7-
Description: Name of the master GenAI IDP stack
8-
Default: 'IDP'
9-
AllowedPattern: '^[a-zA-Z][a-zA-Z0-9-]*$'
10-
ConstraintDescription: Must be a valid CloudFormation stack name
13+
Description: Name of an existing IDP stack (must start with IDP or idp). It is assumed that the administrator has deployed the first IDP solution deployment.
14+
AllowedPattern: '^[Ii][Dd][Pp][a-zA-Z0-9-]*$'
15+
ConstraintDescription: Must be an existing stack name starting with IDP or idp
1116

1217
Resources:
1318
AllPatternsDeployerRole:
1419
Type: AWS::IAM::Role
1520
Properties:
16-
RoleName: !Sub '${MasterStackName}-AllPatterns-Deployer-Secure'
21+
RoleName: 'All-Patterns-Deployer-Role-Secure'
1722
Description: 'Minimal secure role for deploying all GenAI IDP patterns'
1823
MaxSessionDuration: 3600
1924
AssumeRolePolicyDocument:
2025
Version: '2012-10-17'
2126
Statement:
22-
- Effect: Allow
23-
Principal:
24-
AWS: !Sub 'arn:aws:iam::${AWS::AccountId}:root'
25-
Action: 'sts:AssumeRole'
26-
Condition:
27-
StringEquals:
28-
'aws:RequestedRegion': !Ref 'AWS::Region'
2927
- Effect: Allow
3028
Principal:
3129
Service: 'cloudformation.amazonaws.com'
3230
Action: 'sts:AssumeRole'
33-
ManagedPolicyArns:
34-
- 'arn:aws:iam::aws:policy/ReadOnlyAccess'
3531
Policies:
36-
- PolicyName: CorePermissions
32+
- PolicyName: CloudFormationPermissions
3733
PolicyDocument:
3834
Version: '2012-10-17'
3935
Statement:
4036
- Effect: Allow
4137
Action:
4238
- 'cloudformation:*'
39+
Resource: !Sub 'arn:aws:cloudformation:${AWS::Region}:${AWS::AccountId}:stack/*/*'
40+
Condition:
41+
StringLike:
42+
'cloudformation:StackName':
43+
- !Sub '${ExistingIDPStackName}*'
44+
- 'IDP*'
45+
- 'idp*'
46+
- Effect: Allow
47+
Action:
48+
- 'cloudformation:CreateChangeSet'
49+
Resource:
50+
- 'arn:aws:cloudformation:*:aws:transform/Serverless-2016-10-31'
51+
- 'arn:aws:cloudformation:*:aws:transform/Serverless-2016-10-31-*'
52+
- Effect: Allow
53+
Action:
4354
- 'iam:GetRole'
4455
- 'iam:GetRolePolicy'
4556
- 'iam:ListRolePolicies'
@@ -54,7 +65,6 @@ Resources:
5465
- 'iam:UpdateRoleDescription'
5566
- 'iam:UpdateAssumeRolePolicy'
5667
- 'iam:TagRole'
57-
- 'iam:PassRole'
5868
- 'iam:CreateServiceLinkedRole'
5969
- 'lambda:*'
6070
- 'kms:*'
@@ -76,9 +86,7 @@ Resources:
7686
Resource: '*'
7787
Condition:
7888
StringNotEquals:
79-
'aws:RequestedRegion':
80-
- 'us-east-1'
81-
- 'us-west-2'
89+
'aws:RequestedRegion': !Ref 'AWS::Region'
8290
- PolicyName: ServicesPermissions
8391
PolicyDocument:
8492
Version: '2012-10-17'
@@ -89,6 +97,7 @@ Resources:
8997
- 'textract:*'
9098
- 'sagemaker:*'
9199
- 'states:*'
100+
- 'apigateway:*'
92101
- 'appsync:*'
93102
- 'cognito-idp:*'
94103
- 'cognito-identity:*'
@@ -126,6 +135,6 @@ Resources:
126135

127136

128137
Outputs:
129-
AllPatternsDeployerRoleArn:
130-
Description: ARN of the secure all-patterns deployer role
138+
AllPatternsDeployerRoleSecureArn:
139+
Description: ARN of the All-Patterns-Deployer-Role-Secure
131140
Value: !GetAtt AllPatternsDeployerRole.Arn

0 commit comments

Comments
 (0)