Hi, I don’t know if anyone can help but I’m trying...
# typescript
w
Hi, I don’t know if anyone can help but I’m trying to create a public S3 bucket and each time I try and apply the policy I get a 403 access denied error - anyone else come across this?
Copy code
const bucket = new aws.s3.Bucket(`mybucket`, {
    bucket: `mybucket`,
    website: {
        indexDocument: 'index.html',
        errorDocument: 'error.html'
    }
});

// Make the bucket public
const bucketPolicy = new aws.s3.BucketPolicy('bucketPolicy', {
    bucket: bucket.bucket,
    policy: bucket.bucket.apply(publicReadPolicyForBucket)
});
a
the new API for aws require to define bucket policy with this missing piece
Copy code
new aws.s3.BucketPublicAccessBlock(this.bucketName, {
            bucket: myBucket.bucket,
            blockPublicAcls: true,
            blockPublicPolicy: true,
            ignorePublicAcls: true,
            restrictPublicBuckets: true,
        });