In this tutorial, you will redeploy the LetsGo stack that you modified locally to AWS. Upon completion, the changes you made locally will be published and accessible in the cloud.
This tutorial assumes you have already made and tested local modifications to your app as part of the building and running locally tutorial.
Build the Docker images that include the local modifications you made in the web, API, or worker components:
yarn buildx
Re-deployment of a stack to AWS uses the same yarn ops deploy
command as the first deployment you made. The command is designed to be re-entrant and eventually consistent. Run this LetsGo CLI command to re-deploy the modified stack to AWS:
yarn ops deploy -a all
This will run for several minutes and generate a lot of output with the last line reporting a successful deployment:
...
Deployed: all, api, db, web, worker
In the course of re-deployment, the public URLs of the web and API components remain unchanged. If you need to remind yourself what they are, you can always run the following command:
$ yarn ops status
Web
Service
Status RUNNING
Health HTTP 200 (160ms)
Url https://uxb9hhcrtj.us-west-2.awsapprunner.com
...
Api
Service
Status RUNNING
Health HTTP 200 (172ms)
Url https://6ucstfkcn6.us-west-2.awsapprunner.com
...
The output contains a report about the status of the web, API, worker, and database components of your deployment. In the Web and Api sections, locate the Url property. They are the public HTTPS URLs for the web and API components, respectively.
Now, call the health endpoint of the API component with curl. The endpoint is the combination of the API's Url with the /v1/health
path, e.g.:
$ curl https://6ucstfkcn6.us-west-2.awsapprunner.com/v1/health
{"ok":true,"imageTag":"9225060f1903ddef","updatedAt":"2023-11-04T22:08:24.392Z"}
Notice the output is an HTTP 200 response with a JSON providing some basic information about the API component. Also, notice how the updatedAt
field contains a very recent timestamp indicating the time of the re-deployment.
Finally, navigate to the Web component's URL in the browser, and notice how the local change you made got propagated to the cloud.
You have just successfully re-deployed your stack with a simple local modification to AWS. In the next step, you are going to set up authentication with Auth0 to enable authenticating users of your app and secure access to the dashboard section of the web component and to the API component.