Skip to content

A TypeScript mini-project demonstrating how to connect an AWS Lambda function to an S3 bucket using a custom reusable IAM role. Includes unique S3 bucket creation, Lambda with env vars, CloudWatch logging, and CDK outputs for easy debugging.

Notifications You must be signed in to change notification settings

annaescalada/cdk-s3-lambda-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A TypeScript mini-project demonstrating how to connect an AWS Lambda function to an S3 bucket using a custom reusable IAM role. Includes unique S3 bucket creation, Lambda with env vars, CloudWatch logging, and CDK outputs for easy debugging.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published