Skip to content

Commit 10e2f78

Browse files
authored
Merge pull request #117 from aws-samples/fix/sigv4-urls-to-support-s3-kms-encrypted-buckets
support for s3 kms encrypted buckets
2 parents 77d6280 + 256a624 commit 10e2f78

File tree

15 files changed

+94
-5
lines changed

15 files changed

+94
-5
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.3
1+
0.2.4-a

pca-main-nokendra.template

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,3 +612,9 @@ Outputs:
612612
Description: PCA admin user
613613
Value: !Ref AdminUsername
614614

615+
RolesForKMSKey:
616+
Description: When using KMS key to encrypt S3 input/output buckets, KMS key must grant access to these roles.
617+
Value: !Join
618+
- ', '
619+
- - !Sub '${PCAUI.Outputs.RolesForKMSKey}'
620+
- !Sub '${PCAServer.Outputs.RolesForKMSKey}'

pca-main.template

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,3 +758,10 @@ Outputs:
758758
Description: PCA admin user
759759
Value: !Ref AdminUsername
760760

761+
RolesForKMSKey:
762+
Description: When using KMS key to encrypt S3 input/output buckets, KMS key must grant access to these roles.
763+
Value: !Join
764+
- ', '
765+
- - !Sub '${PCAUI.Outputs.RolesForKMSKey}'
766+
- !Sub '${PCAServer.Outputs.RolesForKMSKey}'
767+

pca-server/cfn/lib/bulk.template

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,10 @@ Resources:
132132
- CloudWatchLogsLogGroup:
133133
LogGroupArn: !GetAtt LogGroup.Arn
134134
RoleArn: !GetAtt Role.Arn
135+
136+
Outputs:
137+
138+
RolesForKMSKey:
139+
Value: !Join
140+
- ', '
141+
- - !Sub '"${BulkMoveFiles.Arn}"'

pca-server/cfn/lib/copy-samples.template

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,10 @@ Resources:
7070
Properties:
7171
ServiceToken: !GetAtt CopySamplesFunction.Arn
7272
SamplesVersion: 0.2
73+
74+
Outputs:
75+
76+
RolesForKMSKey:
77+
Value: !Join
78+
- ', '
79+
- - !Sub '"${CopySamplesRole.Arn}"'

pca-server/cfn/lib/pca.template

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,13 @@ Resources:
236236
- CloudWatchLogsLogGroup:
237237
LogGroupArn: !GetAtt LogGroup.Arn
238238
RoleArn: !GetAtt Role.Arn
239+
240+
Outputs:
241+
242+
RolesForKMSKey:
243+
Value: !Join
244+
- ', '
245+
- - !Sub '"${TranscribeLambdaRole.Arn}"'
246+
- !Sub '"${TranscribeRole.Arn}"'
247+
- !Sub '"${SFProcessTurnRole.Arn}"'
248+

pca-server/cfn/lib/trigger.template

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,10 @@ Resources:
164164
- dynamodb:DeleteItem
165165
- dynamodb:GetItem
166166
Resource: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${TableName}
167+
168+
Outputs:
169+
170+
RolesForKMSKey:
171+
Value: !Join
172+
- ', '
173+
- - !Sub '"${FileDropTriggerRole.Arn}"'

pca-server/cfn/pca-server.template

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,15 @@ Resources:
7777
GlueDatabase:
7878
Type: AWS::CloudFormation::Stack
7979
Properties:
80-
TemplateURL: lib/glue-database.template
80+
TemplateURL: lib/glue-database.template
81+
82+
Outputs:
83+
84+
RolesForKMSKey:
85+
Value: !Join
86+
- ', '
87+
- - !Sub '${CopySamples.Outputs.RolesForKMSKey}'
88+
- !Sub '${Trigger.Outputs.RolesForKMSKey}'
89+
- !Sub '${PCA.Outputs.RolesForKMSKey}'
90+
- !Sub '${BulkImport.Outputs.RolesForKMSKey}'
91+

pca-server/src/copy-samples/copy-samples.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ def lambda_handler(event, context):
1212
supportfiles_bucket = os.environ['SUPPORTFILES_BUCKET_NAME']
1313
input_bucket = os.environ['INPUT_BUCKET_NAME']
1414
prefix = os.environ['INPUT_BUCKET_RAW_AUDIO']
15-
if event['RequestType'] != 'Delete':
15+
requestType = event.get('RequestType')
16+
if requestType != 'Delete':
1617
try:
1718
s3Client = boto3.client('s3')
1819
# sample entities
@@ -33,4 +34,5 @@ def lambda_handler(event, context):
3334
print(e)
3435
responseData["Error"] = f"Exception thrown: {e}"
3536
status = cfnresponse.FAILED
36-
cfnresponse.send(event, context, status, responseData)
37+
if requestType:
38+
cfnresponse.send(event, context, status, responseData)

pca-ui/cfn/lib/api.template

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,9 @@ Resources:
198198
Outputs:
199199
Uri:
200200
Value: !Sub https://${Api}.execute-api.${AWS::Region}.amazonaws.com/Prod
201+
202+
RolesForKMSKey:
203+
Value: !Join
204+
- ', '
205+
- - !Sub '"${GetFunctionRole.Arn}"'
206+
- !Sub '"${SwapFunctionRole.Arn}"'

0 commit comments

Comments
 (0)