Creating and populating an S3 bucket with custom resources

As discussed in the introduction to CloudFormation in Chapter 1AWS Fundamentals, it's common for there to be cases where you need more advanced behavior than what is available by default in CloudFormation. Before custom resources, this led AWS developers down the path of doing most of their automation in CloudFormation, and then running some command-line interface (CLIs) commands to fill in the gaps. 

Fast forward to today, and the emerging pattern is to use a custom resource to delegate to an AWS Lambda function. Lambda can fill in the gaps by making API calls on your behalf. While it's also possible to create a custom resource that communicates with your custom code via a Simple Notification Service (SNS), and a compute resource such as an Elastic Compute Cloud (EC2) instance, Lambda should be your first choice. 

In this section, you will learn how to build a custom resource that creates an Amazon Simple Storage Service (S3) bucket, and then populates that bucket with test data. It's a simple example that might not be terribly useful, but it serves to demonstrate the basic concepts. Once you have mastered the technique, you will surely come up with some more creative uses for custom resources.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset