I have created a s3 bucket with CDK
const test_bucket = new s3.Bucket(this, 'assets-bucket-id', {
bucketName: 'assets-bucket-name',
cors: [
{
allowedHeaders: [
"*"
],
allowedMethods: [
s3.HttpMethods.POST,
s3.HttpMethods.PUT,
s3.HttpMethods.GET,
],
allowedOrigins: [
"*"
],
exposedHeaders: [
'x-amz-server-side-encryption',
'x-amz-request-id',
'x-amz-id-2',
'ETag'
],
}
],
})
however i want to add folders of protected
, public
, private
since i m using that for cognito uploads and those are required https://docs.amplify.aws/lib/storage/configureaccess/q/platform/js/
is there anyway i can use cdk s3 module to achieve that?
thanks
CodePudding user response:
As per what @Jarmod clarified in comments, even though it's possible to use Lambda or some scripts to automate creation of folders upon resource creation by CDK (CDK has no native way of doing it at the time being), it's not needed for my use case.
The respective folders will be created upon successful upload.
Tested by configuring to specify desired 'level' (e.g. 'protected') docs.amplify.aws/lib/storage/configureaccess/q/platform/js and it automatically create a folder as the level upon successful upload.