AWS CLI 2 · S3
Mirror a folder, deleting extras
Also delete objects in the bucket that are not in the folder.
aws s3 sync ./dist s3://my-bucket --delete
Caution: Deletes objects that are missing locally. Preview with --dryrun first.
Official AWS CLI 2 documentation