Book Image

Serverless Architectures with AWS

By : Mohit Gupta
Book Image

Serverless Architectures with AWS

By: Mohit Gupta

Overview of this book

Serverless Architecture with AWS begins with an introduction to the serverless model and helps you get started with AWS and Lambda. You'll also get to grips with other capabilities of the AWS Serverless Platform and see how AWS supports enterprise-grade serverless applications with and without Lambda. This book will guide you in deploying your first serverless project and exploring the capabilities of serverless Amazon Athena, an interactive query service that makes it easy to analyze data in Amazon Simple Storage Service (S3 Amazon) using standard SQL. You’ll also learn about AWS Glue, a fully managed ETL service that makes categorizing data easy and cost-effective. You'll study how Amazon Kinesis makes it possible to unleash the potential of real-time data insights and analytics with capabilities such as video streams, data streams, data firehose, and data analytics. Last but not least, you’ll be equipped to combine Amazon Kinesis capabilities with AWS Lambda to create lightweight serverless architectures. By the end of the book, you will be ready to create and run your first serverless application that takes advantage of the high availability, security, performance, and scalability of AWS.
Table of Contents (8 chapters)

Chapter 2: Working with the AWS Serverless Platform


Solution for Activity 3: Setting up a Mechanism to Get an Email Alert When An Object is Uploaded into an S3 Bucket

  1. Go to the AWS S3 service and click on Create bucket.

  2. Provide a Bucket name and select the region where the S3 bucket will be created. Click on Next. Note that the bucket name can't be duplicated.

  3. If you want to change any configuration, you can do it here. Click on Next.

  4. Now, you can change the settings related to the security of the S3 bucket. If you want to allow public access to the S3 bucket, you can uncheck the options here. Click on Next.

  5. Review all of the configuration settings. If you want to change anything, you can go back. Alternatively, click on Finish and your bucket should be created successfully.

  6. Go to the Lambda function that we created in the earlier exercise. Add S3 as a trigger under the Lambda configuration section:

    Figure 2.54: Lambda configuration window

  7. Click on Configuration required and add the required details related to S3 bucket configuration, mainly the bucket name. Keep the rest of the settings as default:

    Figure 2.55: Configure triggers window

  8. Click on Add to add that S3 bucket as a trigger to execute the Lambda function:

    Figure 2.56: Window showing S3 bucket being added as a trigger

  9. Click on Save to save the changes to the Lambda function:

    Figure 2.57: Window showing S3 bucket getting saved

  10. Also, the email message will have changed in the Lambda code to reflect our activity. See line # 8 in the following screenshot. You can customize it based on your needs:

    Figure 2.58: Window showing code of index.js

  11. Now, upload a new sample file to the S3 bucket. You should see an email alert in your mailbox.

  12. Go back to the Amazon S3 service, click on the bucket name, and click on the Upload button.

  13. Click on Add files and select the file that you want to load into the S3 bucket. Click on Next.

  14. Set the file level permissions. Click on Next.

  15. Select the storage class. You can continue with the default option. Click on Next.

  16. Review the configuration and click on Upload.

  17. The file should be uploaded successfully:

    Figure 2.59: Overview section of Amazon S3

  18. Once the file has been uploaded, go to your mailbox and you should see an email alert:

    Figure 2.60: Output showing a new object being uploaded to the S3 bucket

This concludes our activity.