title: Is there a way to do inheritance or code reuse in an AWS CloudFormation template?
body: <p>I'm building a CloudFormation template that includes an <code>AWS::AutoScaling::LaunchConfiguration</code> and an <code>AWS::AutoScaling::AutoScalingGroup</code> that uses that LaunchConfiguration. For my stack I'm going to need multiple AutoScalingGroups, but I want them in separate security groups.</p>
  
  <p>I'm also going to be using CodeDeploy, so my LaunchConfiguration includes the Metadata and UserData properties to install and run the CodeDeploy agent (as shown in line 262 of <a href="http://s3.amazonaws.com/aws-codedeploy-us-east-1/templates/latest/CodeDeploy_SampleCF_Template.json" rel="nofollow">http://s3.amazonaws.com/aws-codedeploy-us-east-1/templates/latest/CodeDeploy_SampleCF_Template.json</a>). Because I have to specify the security group in the LaunchConfiguration instead of in the AutoScalingGroup, I have to have multiple copies of the LaunchConfiguration in my template with only a single-line difference.</p>
  
  <p>Is there a way to reduce the number of times the lengthy Metadata and UserData sections will appear in my template? I tried creating a mapping, but they only allow alphanumeric characters.</p>