Skip to content

S3 deploy: Clean up old files via `--delete`

The following discussion from !9 (merged) should be addressed:

As for now, we could exclude list.json and incident/*:

Before

$ aws s3 sync --dryrun --delete 'dist' s3://$S3_BUCKET_NAME
(dryrun) delete: s3://pleitzen-status-page-mvc-testing/incident/1.json
(dryrun) delete: s3://pleitzen-status-page-mvc-testing/incident/2.json
(dryrun) delete: s3://pleitzen-status-page-mvc-testing/incident/3.json
(dryrun) upload: dist/js/app.9b995020.js to s3://pleitzen-status-page-mvc-testing/js/app.9b995020.js
(dryrun) upload: dist/js/app.9b995020.js.map to s3://pleitzen-status-page-mvc-testing/js/app.9b995020.js.map
(dryrun) delete: s3://pleitzen-status-page-mvc-testing/js/app.f9b33dc7.js
(dryrun) delete: s3://pleitzen-status-page-mvc-testing/js/app.f9b33dc7.js.map
(dryrun) delete: s3://pleitzen-status-page-mvc-testing/list.json

After

$ aws s3 sync --dryrun --delete --exclude "list.json" --exclude "incident/*" 'dist' s3://$S3_BUCKET_NAME
(dryrun) upload: dist/js/app.9b995020.js to s3://pleitzen-status-page-mvc-testing/js/app.9b995020.js
(dryrun) upload: dist/js/app.9b995020.js.map to s3://pleitzen-status-page-mvc-testing/js/app.9b995020.js.map
(dryrun) delete: s3://pleitzen-status-page-mvc-testing/js/app.f9b33dc7.js
(dryrun) delete: s3://pleitzen-status-page-mvc-testing/js/app.f9b33dc7.js.map

Once the directory structure is finalized we can exclude all possible files uploaded by backend 👍

Edited by Peter Leitzen