I have a simple angular SPA project that is being hosted out of an AWS S3 buckets.
The objects in the bucket require a few metadata tags (content-type, cache-control, etc) to make sure the content loads correctly and is updated frequently.
I am using AWS code build to deploy the project to the S3 bucket with the following buildspec.yml file below:
version: 0.2
phases:
pre_build:
commands:
- echo Starting Build Now
- npm install
build:
commands:
- echo Build ready for manufacturing of the artifact
- npm build
post_build:
commands:
- aws s3 sync $BUILD_OUTPUT_LOCATION s3://$BUCKET_NAME --delete
- echo Build completed successfully
Is there a command to have the necessary metadata tags added to the files being sync'ed in the S3 bucket in the post build of this buildspec.yml file?
Use the parameter to add meta tag directly from aws cli, something like:
$ aws s3 cp s3://bucketname/ s3://bucketname/ --recursive --metadata-directive REPLACE --cache-control max-age=86400
$ aws s3 sync $BUILD_OUTPUT_LOCATION s3://$BUCKET_NAME --delete --cache-control max-age=86400