Adding and Customizing Elastic Beanstalk Environment Resources

You may also want to customize your environment resources that are part of your Elastic
Beanstalk environment. For example, you may want to add an Amazon SQS queue
and an alarm on queue depth, or you might want to add an Amazon ElastiCache cluster.
You can easily customize your environment at the same time that you
deploy your application version by including a configuration file with your source
bundle.

You can use the Resources key in a configuration file to create and customize AWS resources in your
environment. Resources defined in configuration files are added to the AWS CloudFormation
template used to launch your environment. All AWS CloudFormation resources types are supported.

For example, the following configuration file adds an Auto Scaling lifecycle hook
to the default Auto Scaling group created by Elastic Beanstalk:

This example defines three resources, hookrole, hooktopic and lifecyclehook. The first
two resources are an IAM role, which grants Amazon EC2 Auto Scaling permission to
publish messages to Amazon SNS, and an SNS topic, which relays messages from the Auto
Scaling group to
an email address. Elastic Beanstalk creates these resources with the specified properties
and types.

The lifecycle hook definition uses two functions to populate values for the hook's properties. {
"Ref" : "AWSEBAutoScalingGroup" } retrieves the name of the Auto Scaling group created by Elastic Beanstalk for the
environment. AWSEBAutoScalingGroup is
one of the standard resource names provided by Elastic Beanstalk.

For AWS::IAM::Role, Ref only returns the name of the
role, not the ARN. To get the ARN for the RoleARN parameter, you use another intrinsic function, Fn::GetAtt instead, which can get
any attribute from a resource. RoleARN: { "Fn::GetAtt" : [ "hookrole", "Arn"] } gets the Arn attribute from the
hookrole resource.

{ "Ref" : "hooktopic" } gets the ARN of the Amazon SNS topic created earlier in the configuration file. The
value returned by Ref
varies per resource type and can be found in the AWS CloudFormation User Guide topic for the
AWS::SNS::Topic resource type.

Javascript is disabled or is unavailable in your browser.

To use the AWS Documentation, Javascript must be enabled. Please refer to your browser's
Help pages for instructions.