Complete DevOps Project from Scratch | [Step-by-Step] Serverless Project - AWS
Welcome to our comprehensive DevOps tutorial! 🚀 In this video, we walk you through a complete Serverless Project on AWS, starting from scratch. Whether you're a beginner or looking to enhance your DevOps skills, this step-by-step guide is designed to help you build and deploy a serverless application using AWS services. What You’ll Learn: 1) Introduction to Serverless Computing 2) Setting Up Your AWS Environment 3) Creating Lambda Functions 4) Deploying and Testing Your Serverless Application 5) Monitoring and Scaling with AWS CloudWatch By the end of this video, you'll have a solid understanding of how to build a fully functional serverless application using DevOps best practices. Architecture diagram: https://drive.google.com/file/d/1BjDaONTTK2GmmiefS9nsLmpCSRCEDvkZ/view?usp=sharing Lambda code: import boto3 import os from PIL import Image from io import BytesIO s3 = boto3.client('s3') ses = boto3.client('ses', region_name='us-east-1') def resize_image(image_data): image = Image.open(BytesIO(image_data)) image = image.resize((512, 512)) buffer = BytesIO() image.save(buffer, format="png") return buffer.getvalue() def lambda_handler(event, context): bucket_name = event['Records'][0]['s3']['bucket']['name'] object_key = event['Records'][0]['s3']['object']['key'] # Download the image from S3 response = s3.get_object(Bucket=bucket_name, Key=object_key) image_data = response['Body'].read() # Resize the image resized_image = resize_image(image_data) # Upload the resized image back to S3 resized_key = f"resized/{object_key}" s3.put_object(Bucket=bucket_name, Key=resized_key, Body=resized_image, ContentType=response['ContentType']) # Send an email notification email_response = ses.send_email( Source='[email protected]', Destination={'ToAddresses': ['[email protected]']}, Message={ 'Subject': {'Data': 'Image Processed'}, 'Body': {'Text': {'Data': f'Your image has been resized and is available at s3://{bucket_name}/{resized_key}'}} } ) return { 'statusCode': 200, 'body': f'Resized image saved to s3://{bucket_name}/{resized_key} and email notification sent.' } Don't forget to like, share, and subscribe for more tutorials like this! #DevOps #Serverless #AWS #Lambda #APIGateway #CloudFormation #Tutorial
Download
0 formatsNo download links available.