Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated May 16, 2024

Modify Amplify-generated Lambda resources with CDK

Amplify Functions utilize the NodejsFunction construct from the AWS Cloud Development Kit (CDK). The underlying resources can be modified, overridden, or extended using CDK after setting the resource on your backend.

amplify/backend.ts
import { defineBackend } from '@aws-amplify/backend';
import { myFunction } from './functions/my-function';
const backend = defineBackend({
myFunction
})
// CDK constructs can be accessed via
backend.myFunction.resources
// where the Lambda function can be found on
backend.myFunction.resources.lambda

The Lambda resource available is a representation of IFunction.

Adding IAM Policies

To learn how to add IAM policies to a Function's execution role, visit the documentation for granting access to other resources.