Issue
AWS Codepipeline supports deploying to S3.
I have an Angular SPA that I'm deploying to S3 as a static website (using Cloudfront, etc)
When I do the ng build --prod
command, I include outputHashing
, which will change the file names deployed over time.
However when deploying to S3 in my Codepipeline, it's not removing old js/css files with different hashes, but continually adding new files
I'd like to use Codepipeline to deploy to S3 with the same behavior as
aws s3 sync ./dist s3://mywebsite-bucket.com/ --acl public-read --delete
Note the --delete
flag.
Is this possible to set up in Codepipeline when deploying to S3?
Solution
I use a similar set-up, as s3 deployment with --delete is currently not possible. Instead, see bash commands below, use a codebuild stage for deployment in the codepipeline.
echo "Syncing directory files to s3"
aws s3 sync ./dist s3://mywebsite-bucket.com/ \
--grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers \
--delete
Note, grants command will achieve same outcome as --acl public-read.
Answered By - pkarfs
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.