Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

Starter template and sample data for the 2018 AWS Summit hackathon

License

Notifications You must be signed in to change notification settings

amazon-archives/aws-summit-hackathon-2018

If you are new to Serverless or want a starting point for the AWS Summit hackathon, you can use this starter project to help you get going. This repo also includes sample data which you can use in your hotel booking app. This code contains a SAM template that defines the resources in your application, starter code for a Node.js Lambda function and some instructions to get you off the ground. Feel free to use this template to get started, though you are not required to use it. You are free to use other tools or libraries that you might be already familiar with.

Getting Started

Here are the instructions to start using the starter project:

  1. Checkout the code: git clone <url> day-one-space-tours
  2. cd day-one-space-tours
  3. You will need an Amazon S3 Bucket to be able to deploy the stack. Choose a bucket name and create a bucket first using the command aws s3 mb s3://<bucketname> This bucket name must be globally unique.
  4. Open package.json in an editor and replace the <sam-package-bucket> string in the package command script with the bucket name you choose in previous step
  5. Now you are ready to get started with development. Use npm install to install required modules and start coding!

Deploying Stack

We have pre-configured simple packaging and deploying instructions in the package.json file. In order to deploy a stack, run npm run package && npm run deploy. This will upload the code from your computer to the Amazon S3 bucket you had created earlier, and call AWS CloudFormation service to deploy the stack.

Get API Gateway URL from Stack Output

  1. Open CloudFormation and sign in if you are not already logged in.
  2. In the table containing the list of stacks created, select the stack named day-one-space-tours. (If you are not able to see the stack in the console, this might usually be because of the region. Make sure that you are in the right region by checking the current region in the navigation bar)
  3. Expand the Outputs section in the stack details page, to find a table similar to the one below containing the required values | Key | Value | Description | | --- | --- | --- | | ApiBaseUrl | Base API URL value | API Gateway endpoint URL for Prod environment |

Get RDS Instance Connection Details from Stack Output

  1. Open CloudFormation and sign in if you are not already logged in.
  2. In the table containing the list of stacks created, select the stack named day-one-space-tours. (If you are not able to see the stack in the console, this might usually be because of the region. Make sure that you are in the right region by checking the current region in the navigation bar)
  3. Expand the Outputs section in the stack details page, to find a table similar to the one below containing the required values | Key | Value | Description | | --- | --- | --- | | HotelDBInstanceAddress | Address of the Hotel DB Instance | Address to connect to the MySQL Hotel DB Instance | | HotelDBInstancePort | Port number of the Hotel DB Instance | Port number to connect to the MySQL Hotel DB Instance |

Reference

  1. AWS Serverless Express: The app is built using this library which makes Express.js apps to work nicely with AWS Lambda and Amazon API Gateway. For the most part, you should be able to use regular Express.js constructs to build your frontend and backend.

General Instructions and Service Documentation Details

  1. This Serverless Application is defined using the AWS Serverless Architecture Model (SAM) Specification. Refer How to create serverless applications using AWS SAM for complete detail on creating and deploying a Serverless Application using AWS SAM.

  2. SAM is deployed using CloudFormation. SAM configuration file mainly describes the Lambda Function for processing and API Gateway for API Endpoints that fronts the Lambda Function.

  3. All logs from your Lambda Function are pushed to Amazon CloudWatch, which can be used to debug the Lambda Function. For more details refer Monitoring and Troubleshooting Lambda-based Applications.

  4. Amazon DynamoDB is a fully managed NoSQL database. The SAM template in this package creates a simple Amazon DynamoDB table. Refer to the following documentation to start using DynamoDB in your Serverless Application:

  1. Amazon Aurora is a MySQL and PostgreSQL compatible relational database built for the cloud. The SAM template in this package creates an instance running MySQL Database in it. Refer to the following documentation to work with MySQL in Amazon Aurora:

About

Starter template and sample data for the 2018 AWS Summit hackathon

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published