mikepfeiffer / cloudformation-custom-resource

AWS Lambda-backed Custom Resource in CloudFormation Template

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CloudFormation Custom Resource Example

This is a sample CloudFormation template that uses an AWS Lambda function as a custom resource. The Lambda retrieves the most recent HVM-based Amazon Linux or Windows 2012 R2 AMI ID based on the desired OS type assigned via input parameter. This was adapted from this example from the CloudFormation documentation.

Use the following steps to launch the template.

  1. Create an S3 bucket in the region where you want to launch the stack.
  2. Add the amilookup.js file in this repo to a zip archive
  3. Upload the zip archive to your new S3 bucket
  4. Launch Custom-Resource-Example.template and assign your bucket name to the S3Bucket parameter. Make sure the S3Key parameter references the correct zip archive file name (amilookup.zip by default).

alt text

Note: You can use the OSType parameter to set the operating system. By default, it is set to Amazon Linux, but also supports Windows Server 2012 R2.

About

AWS Lambda-backed Custom Resource in CloudFormation Template

License:MIT License


Languages

Language:JavaScript 100.0%