In this blog post, we’ll outline how to create a custom IAM role, an AWS Lambda function, and then assign the custom role to the Lambda function in https://towardsthecloud.com/aws-cdk. Before we start building the AWS Lambda and IAM Role construct, you’re required to have done the following prerequisites before you can run AWS CDK code in TypeScript. Install AWS CDK and TypeScript NPM packages

Now that we have our custom role created, we can go ahead and create our AWS Lambda function.

With this code, we’ve now assigned our custom IAM role ‘MyCustomRole’ to the Lambda function ‘MyLambdaFunction’ in our ‘CustomRoleStack’.

Related Articles