Skip to content

Latest commit

 

History

History
36 lines (24 loc) · 1.21 KB

File metadata and controls

36 lines (24 loc) · 1.21 KB

AWS CDK: Lambda S3 Access with Reusable Role

This mini-project demonstrates how to connect an AWS Lambda function to an S3 bucket using a custom, reusable IAM execution role with AWS CDK (TypeScript).

You’ll see:

  • How to create an S3 bucket with a unique name.
  • How to create a Lambda function (Node.js) that reads from S3.
  • How to create a custom IAM role, grant it S3 and CloudWatch permissions, and assign it to the Lambda.
  • How to output key resource names for easy CLI use or debugging.

💻 Stack Overview

  • S3 Bucket: Stores analytics data. Name includes account & region for uniqueness.
  • Lambda Function: Reads from the bucket. Uses Node.js and environment variable for the bucket name.
  • IAM Role: Reusable execution role with all permissions Lambda needs (logs + S3 read).

🛠️ How to Use

1. Prerequisites


2. Install & Build

npm install
npm run build