简体   繁体   中英

How to delete files in S3 using CodePipeline

I have created a CodePipeline that takes input(files) from CodeCommit repository and deploys files to S3 bucket. When I delete files in CodeCommit repository, pipeline doesn't delete the file in the corresponding S3 bucket. In short, I want my S3 bucket to be in sync with CodeCommit repository. How can I achieve this?

My Pipeline doesn't have CodeBuild stage.

AWS-CodeCommit --> CodePipeline --> Deploy-to-Cross-Account-S3

You can add a CodeBuild stage of:

      - aws s3 sync . s3://[bucket_name] --delete

Not sure how to make it work cross-account, tho.

Unfortunately, currently there is no predefined configuration of an S3 Deploy action to delete an S3 object from the pipeline itself.

Docs

The workaround for now will be to add another action on the pipeline to use CodeBuild to perform the objects cleanup before/after deploying them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM