Skip to content

Commit c191684

Browse files
authored
add CloudTrail perms and improve EvironmentCreateForm (#1852)
Users that are not bootstrapping the environment AWS accounts with Admin permissions will face #1839 because their bootstrap role is missing some essential CloudTrail permissions that were introduced by #1811. ⚠️ All users that are using the custom `cdkExecPolicy.yaml` must redownload it and then update the stack with ``` aws cloudformation --region asdasd create-stack --stack-name DataAllCustomCDKExecPolicyStack --template-body file://cdkExecPolicy.yaml --parameters ParameterKey=EnvironmentResourcePrefix,ParameterValue=dataall --capabilities CAPABILITY_NAMED_IAM ``` ⚠️ Because of the policy split users must rerun `cdk bootstrap` in order to include the second policy into the cdk-exec role ``` cdk bootstrap --trust $TRUST_ACCOUNT_ID -c @aws-cdk/core:newStyleStackSynthesis=true --cloudformation-execution-policies \ arn:aws:iam::$ACCOUNT_ID:policy/DataAllCustomCDKPolicy$REGION,\ arn:aws:iam::$ACCOUNT_ID:policy/DataAllCustomCDKPolicy-1-$REGION \ aws://$ACCOUNT_ID/$REGION ``` Improvements * reflect inputs into the fields in the commands to make copy/paste/execute easier * split the named policies because we exceed the maximum length * display the commands in code-like block Demo ![Recording 2025-08-06 at 10 55 54](https://github.com/user-attachments/assets/1cf059c6-954c-4faa-b311-d6323a699472) ### Feature or Bugfix - Bugfix Resolve #1839
1 parent bdfff1b commit c191684

2 files changed

Lines changed: 559 additions & 441 deletions

File tree

deploy/cdk_exec_policy/cdkExecPolicy.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,17 @@ Resources:
113113
- 'iam:*Role*'
114114
Resource: !Sub 'arn:${AWS::Partition}:iam::*:role/cdk-*'
115115

116+
- Sid: CloudTrail
117+
Effect: Allow
118+
Action:
119+
- 'cloudtrail:DeleteTrail'
120+
- 'cloudtrail:CreateTrail'
121+
- 'cloudtrail:AddTags'
122+
- 'cloudtrail:StartLogging'
123+
- 'cloudtrail:PutEventSelectors'
124+
Resource:
125+
- !Sub 'arn:${AWS::Partition}:cloudtrail:${AWS::Region}:${AWS::AccountId}:trail/dataall-environment-*'
126+
116127
- !If
117128
- DashboardsEnabledCondition
118129
- Sid: Quicksight
@@ -240,6 +251,18 @@ Resources:
240251
- !Sub 'arn:${AWS::Partition}:sagemaker:${AWS::Region}:${AWS::AccountId}:notebook-instance/${EnvironmentResourcePrefix}*'
241252
- !Ref AWS::NoValue
242253

254+
CDKCustomExecutionPolicy1:
255+
Type: 'AWS::IAM::ManagedPolicy'
256+
Properties:
257+
ManagedPolicyName: !Join
258+
- ''
259+
- - !Ref PolicyName
260+
- '-1-'
261+
- !Ref AWS::Region
262+
PolicyDocument:
263+
Version: 2012-10-17
264+
Statement:
265+
243266
- Sid: SSM
244267
Effect: Allow
245268
Action:

0 commit comments

Comments
 (0)