I am trying to upload a static webpage onto s3 utilizing the AWS CDK with the S3 and S3 Deployment modules. The issue is that the deployment goes well until I get an error that states that the uploaded file must be a non-empty zip. the documentation indicates that I should be able to use a directory, but I've tried it with a zip as well and the same error persists. Not sure how to proceed.
import * as CDK from "@aws-cdk/core";
import * as S3 from "@aws-cdk/aws-s3";
import * as S3Deployment from "@aws-cdk/aws-s3-deployment";
const path = "../website.zip";
export class WebsiteStack extends CDK.Stack {
constructor(app: CDK.App, id: string, props?: CDK.StackProps) {
super(app, id, props);
const bucket = new S3.Bucket(this, "Files", {
websiteIndexDocument: "index.html",
publicReadAccess: true,
});
new S3Deployment.BucketDeployment(this, "Deployment", {
sources: [S3Deployment.Source.asset(path)],
destinationBucket: bucket,
});
new CDK.CfnOutput(this, "BucketDomain", {
value: bucket.bucketWebsiteDomainName,
});
}
}
question from:
https://stackoverflow.com/questions/65945968/aws-cdk-s3-deployment-error-uploaded-file-must-be-a-non-empty-zip 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…