When creating an Elastic Beanstalk environment using Cloud Formation, how do you set the Tags allocated to the environment and instances?
For example I have the following Resource definition:
"BeanstalkEnvironment" : {
"Type" : "AWS::ElasticBeanstalk::Environment",
"Properties" : {
"ApplicationName" : { "Ref" : "BeanstalkApplication" },
"Description" : "AWS Elastic Beanstalk Environment running Demo Application",
"SolutionStackName" : "64bit Windows Server 2012 R2 running IIS 8.5",
"EnvironmentName" : "Test Site",
"CNAMEPrefix" : { "Ref" : "URLPrefix" },
"OptionSettings" : [
{"Namespace" : "aws:autoscaling:launchconfiguration", "OptionName" : "EC2KeyName", "Value" : { "Ref" : "KeyName" }},
{"Namespace" : "aws:ec2:vpc", "OptionName" : "VPCId", "Value" : { "Ref" : "VPC" }},
{"Namespace" : "aws:ec2:vpc", "OptionName" : "Subnets", "Value" : { "Fn::Join" : [ ",", [ { "Ref" : "SubnetA" }, { "Ref" : "SubnetB" }, { "Ref" : "SubnetC" } ] ] } },
{"Namespace" : "aws:ec2:vpc", "OptionName" : "ELBSubnets", "Value" : { "Fn::Join" : [ ",", [ { "Ref" : "SubnetA" }, { "Ref" : "SubnetB" }, { "Ref" : "SubnetC" } ] ] } },
{"Namespace" : "aws:autoscaling:launchconfiguration", "OptionName":"InstanceType", "Value" : "t2.micro" },
{"Namespace" : "aws:ec2:vpc", "OptionName":"AssociatePublicIpAddress", "Value":"true" },
{"Namespace" : "aws:autoscaling:updatepolicy:rollingupdate", "OptionName":"MaxBatchSize", "Value": "1" },
{"Namespace" : "aws:autoscaling:updatepolicy:rollingupdate", "OptionName":"MinInstancesInService", "Value": "1" },
{"Namespace" : "aws:autoscaling:updatepolicy:rollingupdate", "OptionName":"PauseTime", "Value": "PT5M30S" },
{"Namespace" : "aws:autoscaling:updatepolicy:rollingupdate", "OptionName":"RollingUpdateEnabled", "Value": "true" },
{"Namespace" : "aws:elasticbeanstalk:command", "OptionName":"BatchSize", "Value": "30" },
{"Namespace" : "aws:elb:policies", "OptionName":"ConnectionDrainingEnabled", "Value": "true" }
],
"VersionLabel" : "Sample .NET Application"
}
}
A full working example template is in this gist.
And would like to add a set of Tags to the Beanstalk and the instances it creates e.g.:
"Tags" : [
{ "Key" : "Contact", "Value" : { "Ref" : "Contact" } },
{ "Key" : "BudgetCode", "Value" : { "Ref" : "BudgetCode" } }
]
There does not appear to be a "Tags" element for the Elastic Beanstalk Resource Type in the same way there is for other types (e.g. S3 Buckets).
Any suggestions on how to do this? Would be really good to ensure the instances created are correctly tagged so we can track what instances are used for different projects.
Aucun commentaire:
Enregistrer un commentaire