Go to the AWS S3 service and click on Create bucket.
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.
If you want to change any configuration, you can do it here. Click on Next.
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.
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.
Go to the Lambda function that we created in the earlier exercise. Add S3 as a trigger under the Lambda configuration section:
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:
Click on Add to add that S3 bucket as a trigger to execute the Lambda function:
Click on Save to save the changes to the Lambda function:
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:
Now, upload a new sample file to the S3 bucket. You should see an email alert in your mailbox.
Go back to the Amazon S3 service, click on the bucket name, and click on the Upload button.
Click on Add files and select the file that you want to load into the S3 bucket. Click on Next.
Set the file level permissions. Click on Next.
Select the storage class. You can continue with the default option. Click on Next.
Review the configuration and click on Upload.
The file should be uploaded successfully:
Once the file has been uploaded, go to your mailbox and you should see an email alert:
This concludes our activity.