@wanews/pulumi-lambda
TypeScript icon, indicating that this package has built-in type declarations

0.11.1 • Public • Published

pulumi-lambda

A higher level lambda resource which creates the log group ahead of time so it can be tagged.

This ensures logging costs are tagged appropriately.

Usage

import { LambdaFunction } from '@wanews/pulumi-lambda'

const lambda = new LambdaFunction(`my-lambda`, {
  lambdaOptions: {
    // See https://www.pulumi.com/docs/reference/pkg/aws/lambda/function/#inputs
  },
  getTags(name) {
    return { name }
  },
})

IAM Updates

IAM is eventually consistent, delayLambdaDeployment will add a 30second delay to your lambda being updated to ensure it gets the latest version of your role

Monitoring

RecommendedAlarms provides an opinionated set of alarms for a lambda function:

import { RecommendedAlarms } from '@wanews/pulumi-lambda'

new RecommendedAlarms(name, {
  snsTopicArn: 'arn:aws:sns:<region>:<account>:<topic>',
  lambdaFunctionName: lambda.function.name,
  thresholds: {
    timeoutMs: pulumi
      .output(lambda.function.timeout)
      .apply((timeout) => (timeout ?? 3) * 1000),
  },
  getTags(name) {
    return { name }
  },
})

You can also create individual alarms, or set up multiple alarms for the same metric:

import { AvgDurationAlarm } from '@wanews/pulumi-lambda'

const warn = new AvgDurationAlarm(name, {
  snsTopicArn: 'arn:aws:sns:<region>:<account>:<topic-warn>',
  lambdaFunctionName: lambda.function.name,
  avgDurationMs: 3000,
  getTags(name) {
    return { name }
  },
})

const error = new AvgDurationAlarm(name, {
  snsTopicArn: 'arn:aws:sns:<region>:<account>:<topic-error>',
  lambdaFunctionName: lambda.function.name,
  avgDurationMs: 7000,
  getTags(name) {
    return { name }
  },
})

Readme

Keywords

Package Sidebar

Install

npm i @wanews/pulumi-lambda

Weekly Downloads

1,951

Version

0.11.1

License

MIT

Unpacked Size

550 kB

Total Files

19

Last publish

Collaborators

  • eddie-swm
  • pm_wanews
  • shaw-t
  • bennett.perkins
  • bennettp123