Skip to content

Commit a0f9539

Browse files
[AWSX] feat(forwarder): allow restricting access to s3:GetObject in template (#1062)
1 parent ae53cf6 commit a0f9539

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

aws/logs_monitoring/template.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,10 @@ Parameters:
307307
- "true"
308308
- "false"
309309
Description: Set to true to enable enhanced Lambda metrics. This will generate additional custom metrics for Lambda functions, including cold starts, estimated AWS costs, and custom tags. Default is false.
310+
S3BucketArnList:
311+
Type: CommaDelimitedList
312+
Default: ""
313+
Description: List of S3 bucket ARNs the forwarder can read from (e.g. arn:aws:s3:::my-bucket/*), separated by comma. Leave empty to allow all buckets. Note that restricting this list may break the automatic creation of S3 triggers for buckets not included.
310314
KmsKeyList:
311315
Type: CommaDelimitedList
312316
Default: ""
@@ -402,6 +406,8 @@ Conditions:
402406
- !Equals [!Join ["", !Ref VPCSubnetIds], ""]
403407
SetDdLogLevel: !Not
404408
- !Equals [!Ref DdLogLevel, ""]
409+
SetS3BucketArns: !Not
410+
- !Equals [!Join ["", !Ref S3BucketArnList], ""]
405411
SetDdForwarderDecryptKeys: !Not
406412
- !Equals [!Join ["", !Ref KmsKeyList], ""]
407413
CreateRetryScheduler: !And
@@ -683,7 +689,10 @@ Resources:
683689
- !Ref AWS::NoValue
684690
- Action:
685691
- s3:GetObject
686-
Resource: "*"
692+
Resource: !If
693+
- SetS3BucketArns
694+
- !Ref S3BucketArnList
695+
- "*"
687696
Effect: Allow
688697
# To get object from encrypted s3 buckets. Use PermissionsBoundaryArn to limit access if needed.
689698
# https://aws.amazon.com/premiumsupport/knowledge-center/s3-troubleshoot-403/#AWS_KMS_encryption

0 commit comments

Comments
 (0)