SHPE 2020 National Conference Tech Talk - Serverless Resume Web Application with a REST API backend on AWS
This project contains source code and supporting files for a serverless application that you can deploy with the SAM CLI.
The application uses several AWS resources, including Lambda functions, API Gateway, DynamoDb and Amazon S3. These resources are defined in the template.yaml
file in this project. You can update the template to add AWS resources through the same deployment process that updates your application code.
You will need an AWS account. If you don't have one you can create one for free here.
In order for us to deploy our application you need the following software installed on your computer:
- SAM CLI - Install the SAM CLI
- AWS CLI - Install the AWS CLI
- Node.js - Install Node.js 12
You need to create an Amazon S3 configuration bucket.
- Navigate to the shared layer path
backend/src/sharedLayers/libs/awsLayer/nodejs
and run the command below:
npm install
- Navigate back to the root of the project and run the command below to deploy your application.
node deploy.js <environment> <configs-bucket-name> <website-bucket-name>
Note: Valid environments are dev, test, prod. Bucket names needs to be unique across AWS regions, so make sure to pick an unique name for yours.
- After the deployment completes. Write down your WebsiteURL and your APIUri. You can see a sample output below.
CloudFormation outputs from deployed stack
-------------------------------------------------------------------------------------------------
Outputs
-------------------------------------------------------------------------------------------------
Key WebsiteURL
Description Resume Website URL
Value http://shpe-resume-david.s3-website-us-east-1.amazonaws.com
Key ApiUri
Description API Gateway endpoint URI
Value https://2e4t1u3tfl.execute-api.us-east-1.amazonaws.com/dev
-------------------------------------------------------------------------------------------------
-
Now you need to update the website files in the
public/
folder.- Set the variable API_ENDPOINT in the file
public/scripts.js
with the value from your ApiUri. - Customize the contents of the file
public/index.html
with your name, a description about yourself and your contact information.
- Set the variable API_ENDPOINT in the file
-
Deploy your website files with the following command:
aws s3 cp --recursive public "s3://<website-bucket-name>/"
Note: The website bucket name should be the one that you provided in the deploy script.
-
Navigate to your new Resume Web Application.
-
You will notice that the details you added are there but we are missing the education, experience and endorsements details. We need to call our REST API so we can create this data. Customize the payload samples and request samples below to create your own entries.
Note: Remember to replace the APIUri with yours. You can omit the endDate field if you are still working on that experience or education.
curl --location --request POST 'https://vvmvzb0otg.execute-api.us-east-1.amazonaws.com/dev/endorsements' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Bill Gates",
"description": "David is a great!!!",
"startDate": "01/01/2020"
}'
curl --location --request POST 'https://vvmvzb0otg.execute-api.us-east-1.amazonaws.com/dev/experiences' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "CADMART",
"role": "Network Engineer",
"description": "Network Engineer working on VoIP and SMB networks.",
"startDate": "09/15/2011",
"endDate": "09/15/2013"
}'
curl --location --request POST 'https://vvmvzb0otg.execute-api.us-east-1.amazonaws.com/dev/educations' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Florida International (FIU)",
"role": "Research Assistant",
"description": "Develop driver for new Solid State Drive(SSD) architecture",
"startDate": "06/01/2014",
"endDate": "06/01/2014"
}'
{
"name": "John Perez",
"description": "David is a great!!!",
"startDate": "01/01/2020"
}
{
"name": "Florida International University (FIU)",
"role": "Research Assistant",
"description": "Develop driver for new Solid State Drive(SSD) architecture",
"startDate": "06/01/2013",
"endDate": "06/01/2014"
}
{
"name": "USAA",
"role": "Senior Software Engineer",
"description": "Software Engineer at the Member Data Services Team",
"startDate": "09/15/2014"
}