Skip to content

Instantly share code, notes, and snippets.

@owendall
Forked from stevekinney/full-stack-deploying.md
Created May 30, 2018 14:09
Show Gist options
  • Save owendall/824a32cbee7587119f80348e2b728b1a to your computer and use it in GitHub Desktop.
Save owendall/824a32cbee7587119f80348e2b728b1a to your computer and use it in GitHub Desktop.

Frontend Masters: AWS for Frontend Engineers

You should have the following completed on your computer before the workshop:

  • Have Node.js installed on your system. (Recommended: Use nvm.)
    • Unfortunately, you'll need to be on Node 9.x or earlier. Dependencies are hard and one of the dependencies of one of our dependencies is set to not allow Node 10.x.
  • Create an AWS account. (This will require a valid credit card.)
  • Install multi-factor authentication app (e.g. Authy, Google Authenticator, Duo).
  • Install the AWS CLI. (brew install awscli should do the trick. Otherwise, you'll need Python and PIP, which you can install using brew install python.)
  • Install the AWS Mobile Hub CLI: npm install -g awsmobile-cli or yarn global add awsmobile-cli.
  • Create a Travis CI account. (This should be as simple as logging in via GitHub).
  • Optional: Install the Travis CLI command-line tools: gem install travis -v 1.8.8 --no-rdoc --no-ri
  • Optional: We'll be registering a domain name during the workshop. You can skip this step if you want.

Repositories

S3 Bucket Policy

This might be helpful at some point.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::YOUR_BUCKET_NAME_HERE/*"
        }
    ]
}

Travis Configuration

language: node_js
node_js:
  - '8'
cache:
  yarn: true
  directories:
    - node_modules
script:
  - yarn test
before_deploy:
  - yarn global add travis-ci-cloudfront-invalidation
  - yarn run build
deploy:
  provider: s3
  access_key_id: $AWS_ACCESS_KEY_ID
  secret_access_key: $AWS_SECRET_ACCESS_KEY
  bucket: $S3_BUCKET
  skip_cleanup: true
  local-dir: dist
  on:
    branch: master
after_deploy:
  - travis-ci-cloudfront-invalidation -a $AWS_ACCESS_KEY_ID -s $AWS_SECRET_ACCESS_KEY -c $CLOUDFRONT_ID -i '/*' -b $TRAVIS_BRANCH -p $TRAVIS_PULL_REQUEST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment