AWS - Exercise 1 - Dev Environment
AWS - Exercise 1 - Dev Environment
AWS - Exercise 1 - Dev Environment
[version_1.0]
Note
The exercises in this course will have an associated charge in your AWS account. In
this exercise, you will create the following resources:
The final exercise includes instructions to delete all the resources that you create
in the exercises.
Familiarize yourself with AWS Cloud9 Pricing, Amazon S3 pricing, Amazon API
Gateway pricing, Amazon DynamoDB pricing, AWS Step Functions pricing, AWS
Lambda Pricing, and the AWS Free Tier.
In this exercise, you will start by creating an AWS Cloud9 environment for your
development environment. In this environment, you will download and extract the source
code that you will use in this course. You will deploy the application’s backend
infrastructure by using the AWS Serverless Application Model Command Line Interface
(AWS SAM CLI). You will use AWS SAM to create all the resources that host the backend of
the application: an Amazon API Gateway gateway, AWS Lambda functions, an Amazon
DynamoDB table, and an AWS Step Functions state machine. You will also deploy the
application frontend: a React web application that’s hosted on an S3 bucket, which acts as
the web server. After the application is up and running, you will put the application under
source control by using AWS CodeCommit.
https://aws-tc-largeobjects.s3.us-west-2.amazonaws.com/DEV-AWS-MO-DevOps-C1/exercise-1.html 1/5
06/02/2024, 15:23 Exercise 1: Dev environment
1. Choose Services and search for Cloud9. Make sure you are in the Oregon (US-West-
2) Region.
6. Download the application through the AWS Cloud9 terminal by running the following
command:
wget https://aws-tc-largeobjects.s3.us-west-2.amazonaws.com/DEV-AWS-MO-DevOps-
unzip -o ~/trivia-app.zip
1. In the AWS Cloud9 terminal, change the directory to the trivia-app folder and use
AWS SAM to build the template.yaml file.
cd trivia-app
sam build
sam deploy --guided
AWS SAM settings: For the Stack Name, make sure to copy trivia-app and paste
it. However, for the other entries, accept the default selections by pressing Enter or
Return.
You should get confirmation that the stack was created successfully.
2. From the Outputs table in the terminal output, copy the Websocket Value. It should
look similar to the following example:
https://aws-tc-largeobjects.s3.us-west-2.amazonaws.com/DEV-AWS-MO-DevOps-C1/exercise-1.html 2/5
06/02/2024, 15:23 Exercise 1: Dev environment
wss://xxxxxxxxxx.execute-api.us-west-2.amazonaws.com/Prod
2. In AWS Cloud9, set the Node version to the v16 (codename: Gallium).
cd front-end-react/
npm install
npm run start
Note: There is currently a known issue with the dependency webpack under Node
v17. If you see an error containing code: 'ERR_OSSL_EVP_UNSUPPORTED' ensure you are
running the exercise with Node v16.
After the NPM installation finishes, you might see NPM warnings, but it’s OK to
proceed.
4. In the AWS Cloud9 menu bar, choose Preview and choose Preview Running
Application. Feel free to play around with the game.
5. Finally, in the AWS Cloud9 terminal, close the previewed application and end the
running NPM server by sending a SIGINT (Ctrl+C).
1. Create a uniquely named Amazon Simple Storage Service (Amazon S3) bucket. For
the bucket name, you could use your initials, a set of numbers, and the string trivia-
app-bucket, similar to this example: <your_initials><numbers>-trivia-app-bucket .
aws s3 mb s3://<your_initials><numbers>-trivia-app-bucket/
npm run build
aws s3 sync --acl public-read build s3://<your_initials><numbers>-trivia-app-
Note: If the bucket name you entered already exists, change the numbers and try to
create the bucket again.
https://aws-tc-largeobjects.s3.us-west-2.amazonaws.com/DEV-AWS-MO-DevOps-C1/exercise-1.html 3/5
06/02/2024, 15:23 Exercise 1: Dev environment
2. View the application that’s hosted on your bucket by using the application URL, which
includes the bucket name and index.html. The URL should look similar to the
following example: https://<your_initials><numbers>-trivia-app-
bucket.s3.amazonaws.com/index.html .
1. At the left on the menu bar, choose AWS Cloud9 and choose Go To Your
Dashboard.
4. For the Repository name, enter trivia-app and then choose Create.
7. In the terminal, initialize your repository, create a branch and a commit, and push the
code to the repository.
cd ~/environment/trivia-app/
git init
git checkout -b main
git add .
git commit -m "initial commit"
git remote add origin codecommit://trivia-app
git push origin main
https://aws-tc-largeobjects.s3.us-west-2.amazonaws.com/DEV-AWS-MO-DevOps-C1/exercise-1.html 4/5
06/02/2024, 15:23 Exercise 1: Dev environment
© 2021 Amazon Web Services, Inc. or its affiliates. All rights reserved. This work may not be
reproduced or redistributed, in whole or in part, without prior written permission from Amazon
Web Services, Inc. Commercial copying, lending, or selling is prohibited. Corrections, feedback,
or other questions? Contact us at https://support.aws.amazon.com/#/contacts/aws-training. All
trademarks are the property of their owners.
https://aws-tc-largeobjects.s3.us-west-2.amazonaws.com/DEV-AWS-MO-DevOps-C1/exercise-1.html 5/5