1 | initial version |
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.