I’ve created a mini-tutorial page on the process of creating an automatic deployment CLI for our Angular projects.
This one line execution will run the following:
- ng build –prod
- Make a final build of your application.
- aws s3 rm s3://your-website –recursive
- Deletes all the stuff in your bucket.
- aws s3 cp ./dist s3://your-website –recursive
- Copies the final dist folder that was compiled on your computer and uploads it to your bucket.
- aws configure set preview.cloudfront true
- Enable experimental abilities (which is needed to utilize create-invalidation)
- aws cloudfront create-invalidation –distribution-id XXXXXXXXXXXXXX –paths ‘/*’
- This will create an invalidation on CloudFront. Replace XXXXXXXXXXXXXX with your CloudFront ID specific to your CloudFront distribution.
This is the deployment command:
Please visit the Custom Deployment CLI for Angular Projects for the full details on creating this on the AWS platform.