0.11.1 • Published 2 years ago

@wanews/pulumi-lambda v0.11.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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 }
  },
})
0.11.1

2 years ago

0.11.0

2 years ago

0.10.0

3 years ago

0.9.0

3 years ago

0.3.0

3 years ago

0.8.1

3 years ago

0.8.0

3 years ago

0.5.0

3 years ago

0.4.0

3 years ago

0.7.0

3 years ago

0.6.0

3 years ago

0.5.1

3 years ago

0.2.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.1

3 years ago