aws-samples/sf-summit-hackathon-2018

Name: sf-summit-hackathon-2018

Owner: AWS Samples

Description: Starter template and sample data for the 2018 AWS SF Summit hackathon

Created: 2018-04-03 17:00:22.0

Updated: 2018-04-27 10:27:06.0

Pushed: 2018-04-04 18:59:07.0

Homepage:

Size: 45

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

If you are new to Serverless or want a starting point for the hackathon, you can use this starter project to help you get started faster. 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, a Nodejs Lambda function starter code 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>
  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 <bucketname>
  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 the following documentation to start using DynamoDB in your Serverless Application,

  5. Getting Started with DynamoDB

  6. Programming with DynamoDB

  7. Working with DynamoDB

  8. DynamoDB Developer Guide

  9. 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 the following documentation to work with MySQL in Amazon Aurora,

  10. Connecting to an Aurora DB Cluster

  11. Aurora User Guide


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.