Skip to content

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

License

Notifications You must be signed in to change notification settings

solve-hq/lambda-custom-sdks-layer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages