Attention

This workshop content is over a year old and AWS Amplify has made a great deal of improvements since this content was originally written.

Instead of this content, please check out some of the more up-to-date Amplify content. One great example is the AWS Serverless Airline Booking project. Besides that, you can find lots more excellent AWS Amplify content on the AWS Amplify Community site.

If you would still like to review the content of this workshop, these instructions should still work, provided you use the specific version of AWS Amplify noted in the Prerequisites section.

Deploying our app to S3

Before we build and publish our app, we should free up some memory on the Cloud9 instance. If you’re using a micro Cloud9 instance size, there’s a good chance there won’t be enough memory available to keep our development web server running and to create a production build.

  1. Go to the terminal tab that’s running the development webserver (where you ran npm start)

  2. Press Control-C to interrupt the development webserver and kill it.

The AWS Amplify CLI makes it easy to deploy our app to a publicly accessible bucket on S3.

  1. Run amplify hosting add, select a deployment mode (for this workshop, select ‘Development’), and respond to the questions (you can accept the default value of index.html for the index and error doc).

    $ amplify hosting add
    
    ? Select the environment setup: 
    
    DEV (S3 only with HTTP)
    
    
    ? hosting bucket name 
    
    Accept the propossed one that looks like photoalbums-19700101010203--hostingbucket
    
    
    ? index doc for the website 
    
    index.html
    
    
    ? error doc for the website 
    
    index.html
  2. Run amplify publish. This command includes an amplify push but also publishes changes to our hosted app.

  3. Wait while Amplify builds a production version of our app and deploys it to the hosting bucket. This process usually takes a minute or two.

After the build and deploy finishes, you’ll see a URL for the version of deployed app. Any time you make new changes to the app, just re-run amplify publish whenever you want to push a new build out.