Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 1.53 KB

README.md

File metadata and controls

55 lines (39 loc) · 1.53 KB

lambda-custom-sdks-layer

A Lambda Layer that packages the aws-sdk and aws-xray-sdk to use in nodejs 8.10 lambda functions.

Current Versions

Build and Deploy

To deploy this layer to a new region, use the build.sh script like so:

$ ./build.sh deploy <Region> <Bucket Name> <Profile>

The bucket must exist in the us-west-1 region for the deploy to be successful.

This stack will need to be created in the region before deploying functions that use the layer in said region.

Usage

To use this layer in your nodejs lambda functions, import the AWS::SSM::Parameter created by this stack:

Parameters:
  CustomSDKsLayerVersionArn:
    Type: "AWS::SSM::Parameter::Value<String>"
    Default: "/Solve/Layers/NodeJS/CustomSDKs/ARN"
    Description: The Layer Version ARN of the Custom SDKs Layer which packages aws-sdk and aws-xray-sdk

And then reference the parameter when creating the lambda function resource, like so:

Resources:
  PublishedContentSubscriber:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: ./ingestion/published-content-subscriber
      Handler: index.handler
      Runtime: nodejs8.10
      Layers:
        - !Ref CustomSDKsLayerVersionArn

How to update the sdk versions

Update the dependencies in the ./nodejs/package.json file:

"aws-sdk": "^2.395.0",
"aws-xray-sdk": "^2.2.0"