Jack Fraser
12/04/2021, 10:40 AMStaticSite
? I wish to add a statement allowing a CloudFront Origin Access Identity to perform the s3:GetObject
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity ABC123"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::NEW_STATIC_SITE_S3_BUCKET_NAME/*"
}
Jack Fraser
12/04/2021, 1:56 PMconst app = new sst.StaticSite(this, AppStack.STACK_NAME, this.buildStaticSiteFunction());
const cfResourcePolicy = app.s3Bucket.addToResourcePolicy(new iam.PolicyStatement({
actions: ['s3:GetObject'],
`resources: [${app.s3Bucket.bucketArn}/*
],`
principals: [new iam.ArnPrincipal("arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity ABC123")],
}));
Frank
Frank
s3Bucket
) are exposed as properties.