Skip to content
This repository was archived by the owner on Apr 29, 2024. It is now read-only.

Commit c7c871d

Browse files
authored
Fix restricting access assets.
As it stands, the `S3OriginIdentityExample` has not been associated with the `Cloudfrontdistribution` resulting in access denied errors when attempting to fetch assets. This is fixed creating said association. Verified through rdok/serverless-laravel@acaddcc
1 parent f4277b6 commit c7c871d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

0.4-Building-A-Serverless-Laravel-App-With-AWS-SAM/template.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ Resources:
9999
# The assets (S3)
100100
- Id: Assets
101101
DomainName: !GetAtt Assets.RegionalDomainName
102-
S3OriginConfig: {} # this key is required to tell CloudFront that this is an S3 origin, even though nothing is configured
102+
S3OriginConfig:
103+
OriginAccessIdentity: !Sub "origin-access-identity/cloudfront/${S3OriginIdentityExample}"
103104
# The default behavior is to send everything to AWS Lambda
104105
DefaultCacheBehavior:
105106
AllowedMethods: [GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE]
@@ -140,4 +141,4 @@ Resources:
140141
Outputs:
141142
Domain:
142143
Description: 'CloudFront domain name'
143-
Value: !GetAtt Cloudfrontdistribution.DomainName
144+
Value: !GetAtt Cloudfrontdistribution.DomainName

0 commit comments

Comments
 (0)