| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
The AWS::AutoScaling::LaunchConfiguration type creates an Auto Scaling launch configuration that can be used by an Auto Scaling group to configure EC2 instances in the Auto Scaling group.
This type supports updates. For more information about updating stacks, see Updating AWS CloudFormation Stacks.
Important
When you update a LaunchConfiguration resource, AWS CloudFormation will delete that resource and create a new one with the updated properties and a new name. This update action does not deploy any change across the running EC2 instances in the auto scaling group. In other words, an update simply replaces the LaunchConfiguration so that when the auto scaling group launches new instances, they will get the updated configuration, but existing instances will continue to run with the configuration that they were originally launched with. This works the same way as if you made similar changes manually to an auto scaling group.
{
"Type" : "AWS::AutoScaling::LaunchConfiguration",
"Properties" : {
"BlockDeviceMappings" : [ BlockDeviceMapping, ... ],
"EbsOptimized" : Boolean,
"IamInstanceProfile" : String,
"ImageId" : String,
"InstanceMonitoring" : Boolean,
"InstanceType" : String,
"KernelId" : String,
"KeyName" : String,
"RamDiskId : String,
"SecurityGroups" : [ SecurityGroup, ... ],
"SpotPrice" : String,
"UserData" : String
}
} Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes.
Required: No.
Type: A list of BlockDeviceMappings.
Specifies whether the launch configuration is optimized for EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal EBS I/O performance.
The following instance types can be launched as EBS optimized instances:
Large (m1.large)
Extra large (m1.xlarge)
High-memory quadruple extra large (m2.4xlarge)
Additional fees are incurred when using EBS-optimized instances. For more information, see EBS-Optimized Instances in the Amazon Elastic Compute Cloud User Guide.
Required: No. If this property is not specified, "false" is used.
Type: Boolean.
Update requires: some interruptions
Provides the name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance. The instance profile contains the IAM role.
Required: No.
Type: String. (1–1600 chars)
Provides the unique ID of the Amazon Machine Image (AMI) that was assigned during registration.
Required: Yes.
Type: String.
Indicates whether or not instance monitoring should be enabled for this
autoscaling group. This is enabled by default. To turn it off, set
InstanceMonitoring to "false".
Required: No. Default value is "true".
Type: Boolean.
Specifies the instance type of the EC2 instance.
Required: Yes.
Type: String.
Provides the ID of the kernel associated with the EC2 AMI.
Required: No.
Type: String.
Provides the name of the EC2 key pair.
Required: No.
Type: String.
The ID of the RAM disk to select. Some kernels require additional drivers at launch. Check the kernel requirements for information about whether you need to specify a RAM disk. To find kernel requirements, refer to the AWS Resource Center and search for the kernel ID.
Required: No.
Type: String.
A list that contains the EC2 security groups to assign to the Amazon EC2 instances in the Auto Scaling group. The list can contain the name of existing EC2 security groups, references to AWS::EC2::SecurityGroup resources created in the template, or both.
Required: No.
Type: A list of EC2 security groups.
The spot price for this autoscaling group. If a spot price is set, then the autoscaling group will launch when the current spot price is less than the amount specified in the template.
When you have specified a spot price for an auto scaling group, the group will
only launch when the spot price has been met, regardless of the setting in the
autoscaling group's DesiredCapacity.
For more information about configuring a spot price for an autoscaling group, see Using Auto Scaling to Launch Spot Instances in the AutoScaling Developer Guide.
Required: No.
Type: String.
Update requires: replacement
Note
When you change your bid price by creating a new launch configuration, running instances will continue to run as long as the bid price for those running instances is higher than the current Spot price.
The user data available to the launched EC2 instances.
Required: No.
Type: String.
When the logical ID of this resource is provided to the Ref intrinsic
function, it returns the resource name. For example:
{ "Ref": "MyAutoScalingGroup" }For the resource with the logical ID "MyAutoScalingGroup", Ref will
return the AutoScaling launch config name, such as:
mystack-mylaunchconfig-1DDYF1E3B3I.
For more information about using the Ref function, see Ref.
Example LaunchConfig with Spot Price in Autoscaling Group
This example shows a launch configuration that features a spot price in the AutoScaling group. This launch configuration will only be active if the current spot price is less than the amount in the template specification (0.05).
"LaunchConfig" : {
"Type" : "AWS::AutoScaling::LaunchConfiguration",
"Properties" : {
"KeyName" : { "Ref" : "KeyName" },
"ImageId" : {
"Fn::FindInMap" : [
"AWSRegionArch2AMI",
{ "Ref" : "AWS::Region" },
{
"Fn::FindInMap" : [
"AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch"
]
}
]
},
"SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ],
"SpotPrice" : "0.05",
"InstanceType" : { "Ref" : "InstanceType" }
}
} Example LaunchConfig with IAM Instance Profile
Here's a launch configuration using the IamInstanceProfile property.
Only the AWS::AutoScaling::LaunchConfiguration specification is shown. For the full template, including the definition of, and further references from the AWS::IAM::InstanceProfile object referenced here as "RootInstanceProfile", see: auto_scaling_with_instance_profile.template.
"myLCOne": {
"Type": "AWS::AutoScaling::LaunchConfiguration",
"Properties": {
"ImageId": {
"Fn::FindInMap": [
"AWSRegionArch2AMI",
{ "Ref": "AWS::Region" },
{
"Fn::FindInMap": [
"AWSInstanceType2Arch", { "Ref": "InstanceType" }, "Arch"
]
}
]
},
"InstanceType": { "Ref": "InstanceType" },
"IamInstanceProfile": { "Ref": "RootInstanceProfile" }
}
}Example EBS-optimized volume with specified PIOPS
You can create an AWS CloudFormation stack with auto scaled instances that contain EBS-optimized volumes with a specified PIOPS. This can increase the performance of your EBS-backed instances as explained in Increasing EBS Performance in the Amazon Elastic Compute Cloud User Guide.
Caution
Additional fees are incurred when using EBS-optimized instances. For more information, see EBS-Optimized Instances in the Amazon Elastic Compute Cloud User Guide.
Because you cannot override PIOPS settings in an auto scaling launch configuration, the AMI in your launch configuration must have been configured with a block device mapping that specifies the desired PIOPS. You can do this by creating your own EC2 AMI with the following characteristics:
An instance type of m1.large or greater. This is required
for EBS optimization.
An EBS-backed AMI with a volume type of "io1" and the number of IOPS you want for the Auto Scaling-launched instances.
The size of the EBS volume must accomodate the IOPS you need. There is a 10 : 1 ratio between IOPS and Gibibytes (GiB) of storage, so for 100 PIOPS, you need at least 10 GiB storage on the root volume.
Use this AMI in your Auto Scaling launch configuration. For example, an EBS-optimized
AMI with PIOPS that has the AMI ID ami-7430ba44 would be used in your
launch configuration like this:
"LaunchConfig" : {
"Type" : "AWS::AutoScaling::LaunchConfiguration",
"Properties" : {
"KeyName" : { "Ref" : "KeyName" },
"ImageId" : { "ami-7430ba44" },
"UserData" : { "Fn::Base64" : { "Ref" : "WebServerPort" } },
"SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ],
"InstanceType" : { "m1.large" },
"EbsOptimized" : "true"
}
}, Be sure to set the InstanceType to at least
m1.large and set EbsOptimized to
true.
When you create a launch configuration such as this one, your launched instances will contain optimized EBS root volumes with the PIOPS that you selected when creating the AMI.
To view more LaunchConfiguration snippets, see Auto Scaling Launch Configuration Resource.
Creating Your Own AMIs in the Amazon Elastic Compute Cloud User Guide.
Block Device Mapping in the Amazon Elastic Compute Cloud User Guide.