Skip to content

Instantly share code, notes, and snippets.

@stevekinney
Last active April 9, 2023 21:20
Show Gist options
  • Save stevekinney/941e815e3f2ae824529cc4470e45794c to your computer and use it in GitHub Desktop.
Save stevekinney/941e815e3f2ae824529cc4470e45794c to your computer and use it in GitHub Desktop.

Frontend Masters—Deploying Full Stack: Node.js & React on AWS

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.
    • Install yarn with brew install yarn.
  • 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.

Notes

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
@jeetadhikari92
Copy link

jeetadhikari92 commented Mar 19, 2020

Hi Steve, I was following your course about React Node and AWS. however got stuck in the very beginning as the aws-exports.js file was not being generated inside source, but I could find that same file inside awsmobilejs/#current-backend-info folder .

So I copied that file and put in the src to check if it works but still it dint, Please help.

I get this error
Screenshot 2020-03-19 at 20 07 59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment