imagemagick-aws-lambda-2 icon indicating copy to clipboard operation
imagemagick-aws-lambda-2 copied to clipboard

update example to include AWS-CDK usage

Open nexus-uw opened this issue 5 years ago • 1 comments

hi,

Im not sure where this could go within the existing documentation, so I thought I could just quickly dump it into an issue (feel free to close it)

I had some trouble getting imagemagick-aws-lambda-2 to work with AWS-CDK the other night, so I thought I would share how I got it to work

const imageMagick = new CfnApplication(scope, 'imageMagick', {
      location: {
        applicationId: 'arn:aws:serverlessrepo:us-east-1:145266761615:applications/image-magick-lambda-layer',
        semanticVersion: '1.0.0'
      }
    })

    const lambdaFn = new lambda.Function(this, 'myLambda', {
  ...
      layers: [
        lambda.LayerVersion.fromLayerVersionArn(this, 'imageLayer', imageMagick.getAtt('Outputs.LayerVersion').toString())
      ]
    })

nexus-uw avatar Jan 05 '20 21:01 nexus-uw

:+1: definitely worth adding this to the README.md - thanks for sharing @nexus-uw!

aeksco avatar Feb 27 '20 01:02 aeksco