To upload a zip file to S3 using CDK, follow these steps:
import * as s3 from '@aws-cdk/aws-s3';
import * as s3deploy from '@aws-cdk/aws-s3-deployment';
const myBucket = new s3.Bucket(this, 'MyBucket');
const localPath = path.join(__dirname, '../myapp.zip');
new s3deploy.BucketDeployment(this, 'DeployFiles', {
sources: [s3deploy.Source.asset(localPath)],
destinationBucket: myBucket
});
cdk deploy
This will create an S3 bucket and upload the zip file to it.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-07-02 18:35:49 +0000
Seen: 16 times
Last updated: Jul 02 '23
What is the process of uploading a file using NextJS and formidable?
What is the process for opening e57 files in C#?
How can I install Beegfs on Ubuntu 22.04?
How can a .zip file from GitHub be loaded into Google Colab?
What is the process of using the Multmerge() function in r to combine files in a directory?
In Mac, what is the method to increase the privileges of an executable through setuid?