All Projects → amazon-archives → elasticache-geospatial-public-bikes

amazon-archives / elasticache-geospatial-public-bikes

Licence: Apache-2.0 license
Sample application that demonstrates use of Redis Geospatial commands using Amazon ElastiCache, AWS Lambda, and Serverless Application Model.

Programming Languages

javascript
184084 projects - #8 most used programming language
objective c
16641 projects - #2 most used programming language
python
139335 projects - #7 most used programming language
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to elasticache-geospatial-public-bikes

invoiceless
Serverless backend for sending simple recurring invoices
Stars: ✭ 44 (+29.41%)
Mutual labels:  aws-sam
lamby-cookiecutter
AWS SAM Cookiecutter to Quick Start Rails & Lambda 🐑🛤
Stars: ✭ 17 (-50%)
Mutual labels:  aws-sam
swift-lambda-runtime
⚠️ Deprecated AWS Lambda Runtime - please use https://github.com/swift-server/swift-aws-lambda-runtime instead
Stars: ✭ 68 (+100%)
Mutual labels:  aws-sam
amazonmq-invoke-aws-lambda
Demonstrates an approach to invoking AWS Lambda from messages in an Amazon MQ queue.
Stars: ✭ 23 (-32.35%)
Mutual labels:  aws-sam
serverless-discord-bot
A serverless Discord Bot template built for AWS Lambda based on Discord's slash commands and the slash-create library.
Stars: ✭ 37 (+8.82%)
Mutual labels:  aws-sam
aws-vpc-flow-log-appender
Sample code to append additional information (e.g. Security Group IDs and geolocation data) to VPC Flow Logs for analysis in Elasticsearch.
Stars: ✭ 84 (+147.06%)
Mutual labels:  aws-sam
Lettuce Core
Advanced Java Redis client for thread-safe sync, async, and reactive usage. Supports Cluster, Sentinel, Pipelining, and codecs.
Stars: ✭ 4,319 (+12602.94%)
Mutual labels:  aws-elasticache
aws-appsync-alternative-data-sources
Exploring how AWS AppSync can utilize AWS Lambda to integrate with alternative data sources, including Amazon ElastiCache and Amazon Neptune.
Stars: ✭ 13 (-61.76%)
Mutual labels:  aws-elasticache
spring-cloud-aws
All development has moved to https://github.com/awspring/spring-cloud-aws Integration for Amazon Web Services APIs with Spring
Stars: ✭ 587 (+1626.47%)
Mutual labels:  aws-elasticache
Serverless Application Model
AWS Serverless Application Model (SAM) is an open-source framework for building serverless applications
Stars: ✭ 8,305 (+24326.47%)
Mutual labels:  aws-sam
serverless-todo-demo
Todo app using AWS Serverless Application Model
Stars: ✭ 25 (-26.47%)
Mutual labels:  aws-sam
faaskit
A lightweight middleware framework for functions as a service
Stars: ✭ 24 (-29.41%)
Mutual labels:  aws-sam
serverless-data-pipeline-sam
Serverless Data Pipeline powered by Kinesis Firehose, API Gateway, Lambda, S3, and Athena
Stars: ✭ 78 (+129.41%)
Mutual labels:  aws-sam
aws-serverless-app-sam-cdk
Serverless app with CI/CD pipeline using AWS SAM and AWS CDK
Stars: ✭ 46 (+35.29%)
Mutual labels:  aws-sam
aws-sam-typescript-layers-example
Example project for developing AWS Lambda functions on TypeScript with all goodies: local development, tests, debugging, shared layers (3rd party and your own), and deploy.
Stars: ✭ 168 (+394.12%)
Mutual labels:  aws-sam
cfsec
Static analysis for CloudFormation templates to identify common misconfiguration
Stars: ✭ 53 (+55.88%)
Mutual labels:  aws-sam
xilution-react-todomvc
An implementation of TodoMVC featuring AWS Serverless Application Model (SAM) and Xilution SaaS.
Stars: ✭ 24 (-29.41%)
Mutual labels:  aws-sam

elasticache-geospatial-public-bikes

public-bikes is a sample project that utilizes the AWS Serverless Application Model (SAM) in conjunction with Amazon ElastiCache to find nearby public bike stations.

For more details on this project, please visit the accompanying blog post.

Getting Started

To get started, clone this repository locally:

$ git clone https://github.com/awslabs/elasticache-geospatial-public-bikes.git

The repository contains CloudFormation templates and source code to deploy and run a complete sample application.

Prerequisites

To run the public-bikes sample application, you will need to:

  1. Select an AWS Region into which you will deploy services. Be sure that all required services (AWS Lambda, Amazon API Gateway, Amazon ElastiCache, Amazon DynamoDB) are available in the Region you select.
  2. Confirm your installation of the latest AWS CLI (at least version 1.11.21).
  3. Confirm the AWS CLI is properly configured with credentials that have administrator access to your AWS account.
  4. Install Node.js and NPM.

Setting Up the Environment

Before deploying the sample, install several dependencies using NPM:

$ cd public-bikes/server
$ cd api
$ npm install
$ cd ../stream
$ npm install
$ cd ..

Deploy AWS Resources

The deployment of our AWS resources has been broken into two CloudFormation templates. The first of which contains network resources, including VPC, Subnets, and Gateways. While not strictly necessary in this example, utilizing VPC is intended to help secure our deployment.

  1. Deploy the network stack (network.yaml) via the AWS CLI:

    $ aws cloudformation deploy --template network.yaml --stack-name public-bikes-network
    
  2. Create a new S3 bucket from which to deploy our source code (ensure that the bucket is created in the same AWS Region as your network and services will be deployed):

    $ aws s3 mb s3://<MY_BUCKET_NAME>
    
  3. Using the SAM, package your source code and serverless stack:

    $ aws cloudformation package --template-file app-sam.yaml --s3-bucket <MY_BUCKET_NAME> --output-template-file app-sam-output.yaml
    
  4. Once packaging is complete, deploy the stack (note: this step may require 10-15 minutes as ElastiCache is deployed):

    $ aws cloudformation deploy --template-file app-sam-output.yaml --stack-name public-bikes-dev --capabilities CAPABILITY_IAM
    
  5. After your stack has been created, the sample API has been deployed and you can retrieve the domain of the API (going forward, we will refer to it as API_DOMAIN):

    $ aws cloudformation describe-stacks --stack-name public-bikes-dev --query 'Stacks[0].Outputs[?OutputKey==`ApiDomain`].OutputValue'
    

Data Preparation

For our sample application, we have included a special API endpoint that retrieves sample data (for Chicago's Divvy bike share) and loads it to DynamoDB. To load the data to your environment:

$ curl https://<API_DOMAIN>/Prod/stations/setup

Testing Our Service

Now that we have deployed all of our AWS resources and loaded a small set of sample data, we can test our service by passing a latitude and longitude in downtown Chicago:

$ curl –L 'https://<API_DOMAIN>/Prod/stations?latitude=41.8802596&longitude=-87.6346818'

The resulting response will contain the 10 closest Divvy bike locations to the passed coordinates, including the distance (in miles) and coordinates of the station:

[{
    "name": "Wacker Dr & Washington St-Chicago",
    "distance": "0.2484 mi",
    "coordinates": {
        "latitude": 41.88327238502640881,
        "longitude": -87.63731449842453003
    }
}, {
    "name": "State St & Harrison St-Chicago",
    "distance": "0.5589 mi",
    "coordinates": {
        "latitude": 41.87405360416989453,
        "longitude": -87.62771755456924438
    }
...
]

Cleaning Up

Finally, we will clean up the AWS environment using CloudFormation:

$ aws cloudformation delete-stack --stack-name public-bikes-dev

$ aws cloudformation delete-stack --stack-name public-bikes-network

Authors

  • Josh Kahn - Initial work
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].