|
| 1 | +# CloudFormation Service Role for GenAI IDP Accelerator |
| 2 | + |
| 3 | +This directory contains the `IDP-Cloudformation-Service-Role.yaml` CloudFormation template that creates a dedicated IAM Cloudformation service role for CloudFormation to deploy, manage and modify all GenAI IDP Accelerator patterns deployments. |
| 4 | + |
| 5 | +## <span style="color: blue;">Administrator Access and Deployment Options</span> |
| 6 | + |
| 7 | +**Note**: As detailed in [./docs/deployment.md](../docs/deployment.md), administrator access is required to deploy the GenAI IDP Accelerator solution. However, this directory provides an example CloudFormation service role that administrators can provision to allow other users to pass this role to CloudFormation for deploying and maintaining the solution stack without themselves needing administrator permissions. |
| 8 | + |
| 9 | +This approach enables a security model where: |
| 10 | +- **Administrators** deploy this service role once with their elevated privileges |
| 11 | +- **Developer/DevOps users** can then deploy and manage IDP stacks using this pre-provisioned service role |
| 12 | +- **Operational teams** can maintain the solution without requiring ongoing administrator access |
| 13 | + |
| 14 | +## <span style="color: blue;">What This Role Does</span> |
| 15 | + |
| 16 | +The **IDPAcceleratorCloudFormationServiceRole** 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. |
| 17 | + |
| 18 | +### Key Capabilities |
| 19 | +- **Full CloudFormation Management**: Create, update, delete IDP stacks - This IAM service 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). |
| 20 | + |
| 21 | +- **All Pattern Support**: Works with Pattern 1 (BDA), Pattern 2 (Textract+Bedrock), and Pattern 3 (UDOP) |
| 22 | + |
| 23 | +- **Comprehensive AWS Service Access**: Supports all services required by IDP Accelerator |
| 24 | + |
| 25 | + |
| 26 | +## <span style="color: blue;">Security Features</span> |
| 27 | + |
| 28 | +### Session Management |
| 29 | +- **Administrator Note**: This role also creates an IAM Managed Policy to allow passing the Cloudformation service role. Administrators must add the inline IAM policy to users wanting to deploy or modify CloudFormation IDP stacks with this service role, allowing them to pass the `IDPAcceleratorCloudFormationServiceRole` role to the CloudFormation principal: |
| 30 | + |
| 31 | + ```yaml |
| 32 | + PassRolePolicy: |
| 33 | + Type: AWS::IAM::ManagedPolicy |
| 34 | + Properties: |
| 35 | + ManagedPolicyName: IDP-PassRolePolicy |
| 36 | + Description: Policy to allow passing the IDP CloudFormation service role |
| 37 | + PolicyDocument: |
| 38 | + Version: '2012-10-17' |
| 39 | + Statement: |
| 40 | + - Effect: Allow |
| 41 | + Action: |
| 42 | + - iam:PassRole |
| 43 | + Resource: !GetAtt CloudFormationServiceRole.Arn |
| 44 | + ``` |
| 45 | +
|
| 46 | +### Access Control |
| 47 | +- **Account-Scoped**: Only IAM entities within the same AWS account can assume the role |
| 48 | +
|
| 49 | +
|
| 50 | +## <span style="color: blue;">Files in this Directory</span> |
| 51 | +
|
| 52 | +- `IDP-Cloudformation-Service-Role.yaml` - CloudFormation service role template |
| 53 | +- `README.md` - This documentation file |
| 54 | +- `testing-guide.md` - Testing procedures and validation steps |
| 55 | + |
| 56 | +## <span style="color: blue;">Console Deployment Steps</span> |
| 57 | + |
| 58 | +### Prerequisites |
| 59 | +- AWS Administrator access or IAM permissions to create roles and policies |
| 60 | + |
| 61 | +### Step-by-Step Deployment |
| 62 | + |
| 63 | +1. **Navigate to CloudFormation Console** |
| 64 | + - Open the AWS Management Console |
| 65 | + - Go to **CloudFormation** service |
| 66 | + - Select your preferred region |
| 67 | + |
| 68 | +2. **Create New Stack** |
| 69 | + - Click **"Create stack"** → **"With new resources (standard)"** |
| 70 | + |
| 71 | +3. **Specify Template** |
| 72 | + - Select **"Upload a template file"** |
| 73 | + - Click **"Choose file"** and select `IDP-Cloudformation-Service-Role.yaml` |
| 74 | + - Click **"Next"** |
| 75 | + |
| 76 | +4. **Stack Details** |
| 77 | + - **Stack name**: Enter your stack a name |
| 78 | + - **Parameters**: No parameters required |
| 79 | + - Click **"Next"** |
| 80 | + |
| 81 | +5. **Configure Stack Options** |
| 82 | + - **Tags** (optional): Add any desired tags |
| 83 | + - **Permissions**: Leave as default |
| 84 | + - **Stack failure options**: Leave as default |
| 85 | + - Click **"Next"** |
| 86 | + |
| 87 | +6. **Review and Create** |
| 88 | + - Review all settings |
| 89 | + - **Capabilities**: Check **"I acknowledge that AWS CloudFormation might create IAM resources with custom names"** |
| 90 | + - Click **"Submit"** |
| 91 | + |
| 92 | +7. **Monitor Deployment** |
| 93 | + - Wait for stack status to show **"CREATE_COMPLETE"** |
| 94 | + - Check the **Events** tab for any issues |
| 95 | + |
| 96 | +8. **Retrieve Role ARN** |
| 97 | + - Go to the **Outputs** tab |
| 98 | + - Copy the **CloudFormationServiceRoleArn** value for future use |
| 99 | + |
| 100 | +### Post-Deployment |
| 101 | +- The role is now ready to be used with `--role-arn` parameter in CloudFormation deployments via CLI or as a "an existing AWS Identity and Access Management (IAM) service role that CloudFormation can assume" from the Permissions-Optional section in the Cloudformation Console. |
| 102 | +- Users will need `iam:PassRole` permission to use this role |
| 103 | + |
| 104 | +## <span style="color: blue;">AWS Service Permissions</span> |
| 105 | + |
| 106 | +The role provides comprehensive access to AWS services required by all IDP patterns: |
| 107 | + |
| 108 | +### Core Infrastructure Services |
| 109 | +- **CloudFormation**: `cloudformation:*` - Full stack management |
| 110 | +- **IAM**: Complete role and policy management for IDP components |
| 111 | +- **Lambda**: `lambda:*` - Function creation and management |
| 112 | +- **Step Functions**: `states:*` - State machine orchestration |
| 113 | +- **S3**: `s3:*` - Bucket and object management |
| 114 | +- **DynamoDB**: `dynamodb:*` - Table and data management |
| 115 | +- **SQS**: `sqs:*` - Queue management |
| 116 | +- **EventBridge**: `events:*` - Event rule configuration |
| 117 | +- **KMS**: `kms:*` - Encryption key management |
| 118 | +- **CloudWatch**: `logs:*`, `cloudwatch:*` - Monitoring and logging |
| 119 | +- **Secrets Manager**: `secretsmanager:*` - Secure credential storage and retrieval |
| 120 | + |
| 121 | +### AI/ML Services |
| 122 | +- **Amazon Bedrock**: `bedrock:*` - All foundation models and features |
| 123 | +- **Amazon Textract**: `textract:*` - Document OCR capabilities |
| 124 | +- **Amazon SageMaker**: `sagemaker:*` - Model endpoint management |
| 125 | +- **AWS Glue**: `glue:*` - Data catalog and ETL |
| 126 | +- **OpenSearch Serverless**: `aoss:*` - Vector search capabilities |
| 127 | + |
| 128 | +### Web & API Services |
| 129 | +- **Amazon Cognito**: `cognito-idp:*`, `cognito-identity:*` - Authentication |
| 130 | +- **AWS AppSync**: `appsync:*` - GraphQL API management |
| 131 | +- **CloudFront**: `cloudfront:*` - Content delivery |
| 132 | +- **AWS WAF**: `wafv2:*` - Web application firewall |
| 133 | +- **SNS**: `sns:*` - Notification services |
| 134 | +- **Systems Manager**: `ssm:*` - Parameter management |
| 135 | +- **CodeBuild**: `codebuild:*` - Build automation |
| 136 | + |
| 137 | +### Network & Compute |
| 138 | +- **EC2**: Limited VPC, subnet, and security group management |
| 139 | +- **Application Auto Scaling**: `application-autoscaling:*` |
| 140 | +- **EventBridge Scheduler**: `scheduler:*` |
| 141 | + |
| 142 | +### Additional Permissions |
| 143 | +- **STS**: `sts:AssumeRole` for service integrations |
| 144 | + |
| 145 | +## <span style="color: blue;">Security Considerations</span> |
| 146 | + |
| 147 | +### Regional Restrictions |
| 148 | +- **Deployment Region**: Role assumption restricted to deployment region |
| 149 | +- **Compliance**: Helps meet data residency requirements |
| 150 | + |
| 151 | +### Session Security |
| 152 | +- **Account Isolation**: Cannot be assumed cross-account with the current trust policy |
| 153 | + |
| 154 | +### Permission Scope |
| 155 | +- **Broad Service Access**: Full service permissions for comprehensive IDP deployment services |
| 156 | +- **No Resource Restrictions**: Allows flexibility but requires careful usage |
| 157 | +- **Service Trust**: CloudFormation service can assume role for stack operations |
| 158 | +- **Compliance Note**: Organizations may need to refine and make more granular the service action permissions based on their specific security compliance guidelines and least privilege requirements |
| 159 | + |
| 160 | +## <span style="color: blue;">Troubleshooting</span> |
| 161 | + |
| 162 | +### Common Issues |
| 163 | + |
| 164 | +1. **Access Denied when Using Role**: |
| 165 | + - Verify your user/role has `iam:PassRole` permission for this specific role ARN |
| 166 | + |
| 167 | + - Ensure the role exists and is in the same account |
| 168 | + - Remember: Users cannot assume this role directly - only CloudFormation service can |
| 169 | + |
| 170 | +2. **Region Restriction Errors**: |
| 171 | + - Role should be deployed in same region where IDP stacks are deployed |
| 172 | + |
| 173 | +3. **Session Timeout**: |
| 174 | + - Re-assume the role to get fresh credentials |
| 175 | + |
| 176 | +4. **CloudFormation Deployment Failures**: |
| 177 | + - If using the CLI, ensure you're using `CAPABILITY_IAM` and `CAPABILITY_NAMED_IAM` |
| 178 | + - Check CloudWatch logs for specific service errors |
| 179 | + |
| 180 | + |
| 181 | + |
| 182 | +## <span style="color: blue;">Best Practices</span> |
| 183 | + |
| 184 | +1. **Regular Auditing**: Periodically review who has access to assume this role |
| 185 | +2. **Least Privilege**: Only grant this role to users who need to manage IDP stacks |
| 186 | +3. **Session Management**: Use temporary credentials and limit session duration |
| 187 | +4. **Monitoring**: Enable CloudTrail logging for role assumption and usage |
| 188 | +5. **Rotation**: Regularly review and update the role permissions as needed |
0 commit comments