DeploymentUser:
Type: AWS::IAM::User
Properties:
Path: "/"
Policies:
- PolicyName: deployment-access
PolicyDocument:
Version: '2012-10-17'
Statement:
- Sid: StmtAllowPassRole
Effect: Allow
Action:
- iam:PassRole
Resource:
- !Sub "arn:aws:iam::${AWS::AccountId}:role/${DeployerRoleName}"
- Sid: StmtCloudformation
Effect: Allow
Action:
- cloudformation:Describe*
- cloudformation:EstimateTemplateCost
- cloudformation:GetStackPolicy
- cloudformation:GetTemplate
- cloudformation:GetTemplateSummary
- cloudformation:List*
- cloudformation:PreviewStackUpdate
- cloudformation:ValidateTemplate
Resource:
- "*"
- Sid: StmtCloudformationDelete
Effect: Allow
Action:
- cloudformation:CreateStack
- cloudformation:DeleteStack
Resource:
- !Sub "arn:aws:cloudformation:${AWS::Region}:${AWS::AccountId}:stack/${StackPrefix}*/*"
- Sid: StmtAllowOpsworksDescribeInstances
Effect: Allow
Action:
- opsworks:DescribeInstances
Resource:
- "*"
- Sid: StmtAllowS3PutAndGetInKfsCloudFormationDeploymentBucket
Effect: Allow
Action:
- s3:PutObject
- s3:GetObject
Resource:
- "arn:aws:s3:::kfs-cloudformation-deployment/*"
- Sid: StmtRdsDenyDeleteOnRestrictedDatabase
Effect: Deny
Action:
- rds:DeleteDBInstance
Resource:
- !Sub "arn:aws:rds:${AWS::Region}:${AWS::AccountId}:db:kfs3imp"
- Sid: StmtRdsAllowForKFInstances
Effect: Allow
Action:
- rds:DescribeDBSnapshots
- rds:RestoreDBInstanceFromDBSnapshot
- rds:DescribeDBInstances
- rds:ModifyDBInstance
- rds:CreateDBSnapshot
- rds:DeleteDBInstance
- rds:AddTagsToResource
Resource:
- !Sub "arn:aws:rds:${AWS::Region}:${AWS::AccountId}:db:kf*"
- !Sub "arn:aws:rds:${AWS::Region}:${AWS::AccountId}:og:ua-oracle-ee-12-1"
- !Sub "arn:aws:rds:${AWS::Region}:${AWS::AccountId}:snapshot:kf*"
- !Sub "arn:aws:rds:${AWS::Region}:${AWS::AccountId}:snapshot:rds:kf*"
- !Sub "arn:aws:rds:${AWS::Region}:${AWS::AccountId}:subgrp:rds-private-subnet-group"
- Sid: StmtAllowRdsSnapshotDeletesForTstToDevRestoreCleanup
Effect: Allow
Action:
- rds:DeleteDBSnapshot
Resource:
- !Sub "arn:aws:rds:${AWS::Region}:${AWS::AccountId}:snapshot:kfs3tst-restore-snapshot-*"
- !Sub "arn:aws:rds:${AWS::Region}:${AWS::AccountId}:snapshot:kfs6tst-restore-snapshot-*"
App Deployer CloudFormation Deployment
This CloudFormation template creates an IAM user who is allowed to create certain CloudFormation stacks and pass a role along to run the actual deployment.