0% found this document useful (0 votes)
7 views2 pages

AWS Lambda Assignment 1

hghfgf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

AWS Lambda Assignment 1

hghfgf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment: AWS Lambda Function for Monitoring S3 File Uploads

Objective
Develop an AWS Lambda function that is triggered by file upload events from an Amazon S3
bucket. The function should examine the size of the uploaded file, and if the file size exceeds
100MB, it should log an alert. This assignment aims to familiarize students with AWS
Lambda, Amazon S3, event-driven architecture, and basic logging practices.

Requirements
● AWS Account: Students should have access to an AWS account. They can use an
existing account or sign up for the AWS Free Tier.
● Knowledge Prerequisites: Students should have a basic understanding of AWS

ills
services, particularly AWS S3 and AWS Lambda, IAM roles, and CloudWatch Logs.
● Tools: Students may use the AWS Management Console, AWS CLI, or AWS SDKs
based on their comfort level with these tools.

Instructions

Sk
● S3 Bucket Setup
○ Create a new Amazon S3 bucket in your AWS account. Take note of the
bucket name, as it will be needed later.
○ Ensure the bucket is configured to log access requests for auditing purposes.
a
● IAM Role Creation
at
○ Create a new IAM role that the Lambda function will assume. This role must
have permissions to access S3 data and write logs to Amazon CloudWatch.
D

● Lambda Function Development


○ Create a new AWS Lambda function from the AWS Management Console.
○ Assign it the IAM role created in the previous step.
○ Set the runtime to Python 3.8 or any other preferred runtime that supports S3
w

event processing.
○ The function should be triggered by S3 upload events. Configure the trigger
ro

appropriately within the Lambda function settings.


○ Write the Lambda function code to:
■ Be triggered upon file uploads to the specified S3 bucket.
G

■ Retrieve the size of the uploaded file.


■ Compare the file size against the 100MB threshold.
■ Log an alert message if the file exceeds the threshold.

● S3 to Lambda Integration
○ Configure the previously created S3 bucket to trigger the Lambda function
upon file uploads. Specify the event type as "All object create events."

● Testing and Validation


○ Test the Lambda function by uploading files of various sizes to the S3 bucket.
Include tests for files smaller than 100MB and larger than 100MB.
○ Validate that the Lambda function executes as expected by reviewing the logs
in Amazon CloudWatch. Ensure that an appropriate alert is logged for files
exceeding the size threshold.

● Deliverables
○ A report documenting the creation process of the S3 bucket, IAM role, and
Lambda function. Include any challenges encountered and how they were
resolved.
○ Screenshots of:
■ The Lambda function configuration, particularly the trigger setup.
■ The IAM role's permissions.
■ The CloudWatch log entries for the test file uploads.

ills
Sk
a
at
D
w
ro
G

You might also like