Giter Club home page Giter Club logo

here-aws-sar's Introduction

AWS SAR for HERE Maps APIs

Introduction

This project provides AWS Lambdas as proxies for several of the HERE Location Services APIs. These AWS Lambdas are packaged as per the AWS Serverless Application Model.

"AWS SAR is natively supported by AWS CloudFormation and defines simplified syntax for expressing serverless resources. The specification currently covers APIs, Lambda functions and Amazon DynamoDB tables."

Benefits

The AWS API Gateway supports configuring both Cache and Throttling, and the lambdas are open source: we welcome pull requests with circuit breakers, graceful error handling, etc.!

Requirements

To successfully call the HERE Maps APIs through the proxies in this project you need to obtain HERE API credentials. Multiple plans are available: https://aws.amazon.com/marketplace/pp/B07JPLG9SR/?ref=_ptnr_aws_sar_github#pricing-information.

List of APIs with AWS Lambda Proxies

Setup

  • Step 1: Register for an API Key

    Visit the HERE Location Services on AWS Marketplace, and review the Access Control FAQ.

  • Step 2: Register an AWS Account

    Visit AWS and sign up for a Free Tier account.

  • Step 3: Install the AWS CLI and run "aws configure"

    Download and install the AWS CLI, and run aws configure as per the AWS CLI User Guide.

  • Step 4: Get the Source

    From GitHub: clone this repository, or download the ZIP.

    The folder containing the lambda source code (JS) and CloudFormation templates (YML) is serverlessFunctions.

  • Step 5: Package

    An S3 bucket is required as a destination for the AWS SAR package. If you don't have one already, create one:

    
    Note: If the folder contains a `package.json` file: run `npm update`:
    
    `x:\src\here-aws-repository\serverlessFunctions\mapimage>npm update
    

    Use the AWS CLI to package (note the folder layout):

    x:\src\here-aws-repository\serverlessFunctions>aws cloudformation package --s3-bucket here-maps-api--aws-sar --template-file geocode\geocode.yml --output-template-file geocode-packaged.yml

  • Step 6: Deploy

    Use the AWS CLI to deploy the AWS SAR package using CloudFormation:

    x:\src\here-aws-repository\serverlessFunctions>aws cloudformation deploy --capabilities CAPABILITY_IAM --stack-name "HERE-Maps-API--GeoCode" --parameter-overrides HereApiKey=<apiKey> --template-file geocode-packaged.yml

  • Step 7: Find new API Gateway URL

    Once deployment completes, look for the URL of the new API Gateway. It should follow this pattern:

    https://<apigw>.execute-api.<region>.amazonaws.com/...

    The API Gateway URL is an output from the CloudFormation template and can be found among the tabs when selecting a Stack in the AWS Console.

    Alternatively look at the API Gateway in the AWS Console, select Stages, and then expand the tree until you see "Invoke URL".

  • Step 8: Secure your API Gateways/Lambdas

    The AWS Lambda proxies deployed above do not impose authentication or authorization restrictions!

Help

You must decide how you will control access to your API Gateway and Lambdas.

For guidance, see the AWS Lambda FAQ.

Consider implementing AWS API Gateway Custom Authorizers.

HERE Maps APIs with Lambda Proxies

The below list of HERE Maps APIs has one Lambda each as a proxy.

Note:

  • All APIs except Map Image and Map Tile will return JSON response. For error scenarios, response JSON will be with 4xx - 5xx response code and details of error.

  • For Map Image and MapTile APIs, success response will return base 64 encoding of map image (not JSON) and for failures, message as error in downloading map will be returned.

Geocoding and Search API v7

URL Mapping

API HERE URL Prefix AWS Lambda App URL Prefix
discover https://discover.search.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/geocode/api/
geocode https://geocode.search.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/geocode/api/
autosuggest https://autosuggest.search.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/geocode/api/
browse https://browse.search.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/geocode/api/
lookup https://lookup.search.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/geocode/api/
revgeocode https://revgeocode.search.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/geocode/api/
  • For detailed examples refer here.
Map Image

URL Mapping

API HERE URL Prefix AWS Lambda App URL Prefix
Images https://image.maps.ls.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/mapimage/api/
  • For detailed examples refer here.
Map Tile

URL Mapping

API HERE URL Prefix AWS Lambda App URL Prefix
MapTile https://{1-4}.traffic.maps.ls.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/maptile/api/traffic/
MapTile https://{1.4}.base.maps.ls.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/maptile/api/base/
MapTile https://{1.4}.aerial.maps.ls.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/maptile/api/aerial/
  • For detailed examples refer here.
Positioning

URL Mapping

API HERE URL Prefix AWS Lambda App URL Prefix
Position https://pos.ls.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/position/api/
  • For detailed examples refer here.
Routing API v8 & Routing Waypoints Sequence

URL Mapping

API HERE URL Prefix AWS Lambda App URL Prefix
CalculateRoute https://router.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/routing/api/
Routing((Isoline)) https://isoline.route.ls.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/routing/api/isoline.route/
Routing(Matrix) https://matrix.route.ls.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/routing/api/matrix.route/
  • For detailed examples refer here.
Toll Cost

URL Mapping

API HERE URL Prefix AWS Lambda App URL Prefix
Toll Cost https://tce.api.here.com/2/calculateroute.json https://<apigw>.execute-api.<region>.amazonaws.com/Prod/tollcost
  • For detailed examples refer here.
Traffic

URL Mapping

API HERE URL Prefix AWS Lambda App URL Prefix
Traffic https://traffic.ls.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/traffic/api/traffic/
Traffic(tiles) https://{1..4}.traffic.maps.ls.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/traffic/api/traffic.maps/
  • For detailed examples refer here.
Public Transit API v8

URL Mapping

API HERE URL Prefix AWS Lambda App URL Prefix
Next Departures https:/transit.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/transit/api/
Station Search https:/transit.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/transit/api/
Routing https:/transit.router.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/transit/api/
  • For detailed examples refer here.
Weather

URL Mapping

API HERE URL Prefix AWS Lambda App URL Prefix
Weather https://weather.ls.hereapi.com/ https://<apigw>.execute-api.<region>.amazonaws.com/Prod/weather/api/
  • For detailed examples refer here.

License

Copyright (c) 2017-2019 HERE Europe B.V.

See the LICENSE file in the root of this project for license details.

here-aws-sar's People

Contributors

antondelsink avatar kishor-bhatt avatar palermo4 avatar sowmiyakrishnan avatar sschuberth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

here-aws-sar's Issues

MapImage: Cannot find module 'request'

I've just deployed MapImage from the AWS Serverless Application Repository (https://serverlessrepo.aws.amazon.com/applications/arn:aws:serverlessrepo:us-east-1:242721718429:applications~MapImage) but am seeing the below error when visiting https://<apigw>.execute-api.<region>.amazonaws.com/Stage/mapimage?t=1&lat=63.529722&lon=-19.513889, any tips?

{"errorMessage":"Cannot find module 'request'","errorType":"Error","stackTrace":["Object.<anonymous> (/var/task/mapimage.js:25:17)","Module._compile (module.js:570:32)","Object.Module._extensions..js (module.js:579:10)","Module.load (module.js:487:32)","tryModuleLoad (module.js:446:12)","Function.Module._load (module.js:438:3)"]}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.