Write S3 objects with CDK

Question:

I am trying to code a CDK doing the job of writing some empty objects inside some folders that I need to be visible in my bucket.

I have found this answer
https://serverfault.com/questions/957686/how-to-upload-a-file-into-s3-bucket-using-cloudformation-script showing the way in CloudFormation.

I wonder if somebody has done something similar with CDK.

Thank you

Answer:

You can achieve this with @aws-cdk/aws-s3-deployment.

Using TypeScript:

Asset feature will require the execution of the command:

cdk bootstrap aws://<account>/<region>

that will run a cloudFormation and create a bucket with name cdktoolkit-stagingbucket-<random_chars>.

Leave a Reply