So I am trying to automatically create an invalidation on AWS but get AWS: Command not found. Here is my config file below.
defaults: &defaults
working_directory: ~/repo
version: 2
jobs:
build:
<<: *defaults
docker:
- image: circleci/ruby:2.5
environment:
BUNDLE_PATH: ~/repo/vendor/bundle
steps:
- checkout
- restore_cache:
keys:
- rubygems-v1-{{ checksum "Gemfile.lock" }}
- rubygems-v1-fallback
- run:
name: Bundle Install
command: bundle check || bundle install
- save_cache:
key: rubygems-v1-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- run:
name: Jekyll build
command: bundle exec jekyll build
- run:
name: HTMLProofer tests
command: |
bundle exec htmlproofer ./_site \
--allow-hash-href \
--check-html \
--disable-external
- persist_to_workspace:
root: ./
paths:
- _site
deploy:
<<: *defaults
docker:
- image: circleci/python:3.6.3
environment:
S3_BUCKET_NAME: NAME GOES HERE
steps:
- attach_workspace:
at: ./
- run:
name: Install AWS CLI
command: pip install awscli --upgrade --user
- run:
name: Upload to s3
command: ~/.local/bin/aws s3 sync ./_site s3://NAMEGOESHERE/ --delete --acl public-read
# ACTIVATE CLOUD FRONT CLI
- run:
name: activate cloud front
command: |
aws configure set preview.cloudfront true
aws configure set preview.create-invalidation true
# Invalidate Cloudfront
- run:
name: Invalidate Cloudfront
command: aws cloudfront create-invalidation --distribution-id MYID --paths /\*
workflows:
version: 2
test-deploy:
jobs:
- build
- deploy:
requires:
- build
filters:
branches:
only: master
I will be honest that this is my first attempt at this so apologies for the noob code. Error code I get is this.
#!/bin/bash -eo pipefail
aws configure set preview.cloudfront true
aws configure set preview.create-invalidation true
/bin/bash: aws: command not found
Exited with code 127
Everything else works. When I make changes the S3 bucket automatically updates. Just does not create a new invalidation.