Skip to content

Commit

Permalink
use inline policy and drop bucket attributes that are already the def…
Browse files Browse the repository at this point in the history
…ault
  • Loading branch information
asjohnston-asf committed Jun 4, 2024
1 parent 4b06450 commit 5f7ec02
Showing 1 changed file with 13 additions and 27 deletions.
40 changes: 13 additions & 27 deletions cloudformation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,11 @@ Resources:
Bucket:
Type: AWS::S3::Bucket
Properties:
PublicAccessBlockConfiguration:
BlockPublicAcls: True
IgnorePublicAcls: True
BlockPublicPolicy: True
RestrictPublicBuckets: True
LifecycleConfiguration:
Rules:
- Status: Enabled
ExpirationInDays: 7
- Status: Enabled
AbortIncompleteMultipartUpload:
DaysAfterInitiation: 1
OwnershipControls:
Rules:
- ObjectOwnership: BucketOwnerEnforced
Tags:
- Key: DAR
Value: "NO"
Expand Down Expand Up @@ -62,20 +52,16 @@ Resources:
Principal:
Service: lambda.amazonaws.com
Effect: Allow
ManagedPolicyArns:
- !Ref LambdaPolicy

LambdaPolicy:
Type: AWS::IAM::ManagedPolicy
Properties:
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- logs:CreateLogStream
- logs:PutLogEvents
Resource: !Sub "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/*"
- Effect: Allow
Action: s3:PutObject
Resource: !GetAtt Bucket.Arn
Policies:
- PolicyName: policy
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- logs:CreateLogStream
- logs:PutLogEvents
Resource: !Sub "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/*"
- Effect: Allow
Action: s3:PutObject
Resource: !Sub "arn:aws:s3:::${Bucket}/*"

0 comments on commit 5f7ec02

Please sign in to comment.