Skip to content

Commit

Permalink
feat(cdk): add PackedLambdaFn
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Apr 24, 2024
1 parent 1194229 commit b3981c9
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 98 deletions.
16 changes: 4 additions & 12 deletions cdk/TestStack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import {
aws_lambda as Lambda,
Stack,
} from 'aws-cdk-lib'
import { LambdaLogGroup, LambdaSource } from '../src/cdk.js'
import { LambdaSource } from '../src/cdk.js'
import type { PackedLayer } from '../src/layer.js'
import type { TestLambdas } from './packTestLambdas.js'
import { PackedLambdaFn } from '../src/PackedLambdaFn.js'

export class TestStack extends Stack {
public constructor(
Expand All @@ -34,22 +35,13 @@ export class TestStack extends Stack {
compatibleRuntimes: [Lambda.Runtime.NODEJS_20_X],
})

const fn = new Lambda.Function(this, 'fn', {
handler: lambdaSources.test.handler,
architecture: Lambda.Architecture.ARM_64,
runtime: Lambda.Runtime.NODEJS_20_X,
const lambda = new PackedLambdaFn(this, 'fn', lambdaSources.test, {
timeout: Duration.seconds(1),
memorySize: 1792,
code: new LambdaSource(this, lambdaSources.test).code,
description: 'Returns a ULID',
environment: {
NODE_NO_WARNINGS: '1',
},
layers: [baseLayer],
...new LambdaLogGroup(this, 'fnLogs'),
})

const url = fn.addFunctionUrl({
const url = lambda.fn.addFunctionUrl({
authType: Lambda.FunctionUrlAuthType.NONE,
})

Expand Down
Loading

0 comments on commit b3981c9

Please sign in to comment.