Auto Scaling Group | Create - AMS Advanced Change Type Reference

Auto Scaling Group | Create

Use to create an Auto Scaling group, the launch configuration to use to create new instances when needed, and CloudWatch metrics and alarms for the group.

Full classification: Deployment | Advanced stack components | Auto Scaling group | Create

Change Type Details

Change type ID

ct-2tylseo8rxfsc

Current version

4.0

Expected execution duration

360 minutes

AWS approval

Required

Customer approval

Not required

Execution mode

Automated

Additional Information

Create Auto Scaling groups

How it works:

  1. Navigate to the Create RFC page: In the left navigation pane of the AMS console click RFCs to open the RFCs list page, and then click Create RFC.

  2. Choose a popular change type (CT) in the default Browse change types view, or select a CT in the Choose by category view.

    • Browse by change type: You can click on a popular CT in the Quick create area to immediately open the Run RFC page. Note that you cannot choose an older CT version with quick create.

      To sort CTs, use the All change types area in either the Card or Table view. In either view, select a CT and then click Create RFC to open the Run RFC page. If applicable, a Create with older version option appears next to the Create RFC button.

    • Choose by category: Select a category, subcategory, item, and operation and the CT details box opens with an option to Create with older version if applicable. Click Create RFC to open the Run RFC page.

  3. On the Run RFC page, open the CT name area to see the CT details box. A Subject is required (this is filled in for you if you choose your CT in the Browse change types view). Open the Additional configuration area to add information about the RFC.

    In the Execution configuration area, use available drop-down lists or enter values for the required parameters. To configure optional execution parameters, open the Additional configuration area.

  4. When finished, click Run. If there are no errors, the RFC successfully created page displays with the submitted RFC details, and the initial Run output.

  5. Open the Run parameters area to see the configurations you submitted. Refresh the page to update the RFC execution status. Optionally, cancel the RFC or create a copy of it with the options at the top of the page.

How it works:

  1. Use either the Inline Create (you issue a create-rfc command with all RFC and execution parameters included), or Template Create (you create two JSON files, one for the RFC parameters and one for the execution parameters) and issue the create-rfc command with the two files as input. Both methods are described here.

  2. Submit the RFC: aws amscm submit-rfc --rfc-id ID command with the returned RFC ID.

    Monitor the RFC: aws amscm get-rfc --rfc-id ID command.

To check the change type version, use this command:

aws amscm list-change-type-version-summaries --filter Attribute=ChangeTypeId,Value=CT_ID
Note

You can use any CreateRfc parameters with any RFC whether or not they are part of the schema for the change type. For example, to get notifications when the RFC status changes, add this line, --notification "{\"Email\": {\"EmailRecipients\" : [\"email@example.com\"]}}" to the RFC parameters part of the request (not the execution parameters). For a list of all CreateRfc parameters, see the AMS Change Management API Reference.

INLINE CREATE:

  1. Issue the create RFC command with execution parameters provided inline (escape quotation marks when providing execution parameters inline) and then submit the returned RFC ID. For example:

    Required parameters only:

    aws --profile saml --region us-east-1 amscm create-rfc --change-type-id "ct-2tylseo8rxfsc" --change-type-version "3.0" --title "ASG-Create-QC" --execution-parameters "{\"Description\":\"Create a new ASG\",\"VpcId\":\"VPC_ID\",\"Name\":\"MyASG\",\"TimeoutInMinutes\":360,\"Parameters\":{\"InstanceAmiId\":\"AMI_ID\",\"InstanceSubnetId\":\"SUBNET_ID\"}}"

    Most parameters, except Tags and UserData:

    aws --profile saml amscm create-rfc --change-type-id "ct-2tylseo8rxfsc" --change-type-version "3.0" --title "Stack-Create-ASG-IC" --execution-parameters "{\"Description\":\"MyTestASG\",\"VpcId\":\"VPC_ID\",\"StackTemplateId\":\"stm-suw38u20000000000\",\"Name\":\"MyTestASG\",\"TimeoutInMinutes\":60,\"Parameters\":{\"ASGAmiId\":\"ami-0021317f\",\"ASGCooldown\":300,\"ASGDesiredCapacity\":1,\"ASGEBSOptimized\":false,\"ASGHealthCheckGracePeriod\":1800,\"ASGIAMInstanceProfile\":\"customer-mc-ec2-instance-profile\",\"ASGInstanceDetailedMonitoring\":true,\"ASGInstanceRootVolumeIops\":0,\"ASGInstanceRootVolumeName\":\"TEST\",\"ASGInstanceRootVolumeType\":\"standard\",\"ASGInstanceType\":\"m4.large\",\"ASGMaxInstances\":1,\"ASGMinInstances\":1,\"ASGScaleDownMetricName\":\"CPUUtilization\",\"ASGScaleDownPolicyCooldown\":300,\"ASGScaleDownPolicyEvaluationPeriods\":4,\"ASGScaleDownPolicyPeriod\":60,\"ASGScaleDownPolicyScalingAdjustment\":-1,\"ASGScaleDownPolicyStatistic\":\"Average\",\"ASGScaleDownPolicyThreshold\":35,\"ASGScaleUpMetricName\":\"CPUUtilization\",\"ASGScaleUpPolicyCooldown\":60,\"ASGScaleUpPolicyEvaluationPeriods\":2,\"ASGScaleUpPolicyPeriod\":60,\"ASGScaleUpPolicyScalingAdjustment\":2,\"ASGScaleUpPolicyStatistic\":\"Average\",\"ASGScaleUpPolicyThreshold\":75,\"ASGSubnetIds\":[\"SUBNET1_ID\",\"SUBNET2_ID\"],\"ASGUserData\":\"\"}}"

TEMPLATE CREATE:

  1. Output the execution parameters JSON schema for this change type to a file in your current folder; this example names it CreateAsgParams.json:

    aws amscm get-change-type-version --change-type-id "ct-2tylseo8rxfsc" --query "ChangeTypeVersion.ExecutionInputSchema" --output text > CreateAsgParams.json
  2. Modify and save the schema as follows. For example, you can replace the contents with something like this:

    Note

    Scripts are newline-delimited (separate with literal: "\n"), also, scripts entered as UserData are executed as the "root" user and do not need to use the "sudo" command.

    The RFC waits up to six hours for all of the UserData script commands to run before returning a final status of success or failure.

    { "Description": "Create_WordPress_ASG", "VpcId": "VPC_ID", "StackTemplateId": "stm-suw38u00000000000", "Name": "WP_ASG", "Tags": [{"Key": "Name","Value": "WP_ASG"}], "TimeoutInMinutes": 60, "ASGAmiId": "AMI_ID", "ASGLoadBalancerNames": ["ELB_NAME"], "ASGSubnetIds": ["PRIVATE_AZ1", "PRIVATE_AZ2"], "ASGUserData": "#!/bin/bash \n REGION=$(curl 169.254.169.254/latest/meta-data/placement/availability-zone/ | sed 's/[a-z]$//') \n yum -y install ruby httpd \n chkconfig httpd on \n service httpd start \n touch /var/www/html/status \n cd /tmp \n curl -O https://aws-codedeploy-$REGION.s3.amazonaws.com/latest/install \n chmod +x ./install \n ./install auto \n chkconfig codedeploy-agent on \n service codedeploy-agent start" }
  3. Output the JSON template for CreateRfc to a file in your current folder; example names it CreateAsgRfc.json:

    aws amscm create-rfc --generate-cli-skeleton > CreateAsgRfc.json
  4. Modify and save the JSON file as follows. For example, you can replace the contents with something like this:

    { "ChangeTypeVersion": "3.0", "ChangeTypeId": "ct-2tylseo8rxfsc", "Title": "ASG-For-WP-Stack-RFC" }
  5. Create the RFC, specifying the CreateAsgRfc file and the execution parameters file:

    aws amscm create-rfc --cli-input-json file://CreateAsgRfc.json --execution-parameters file://CreateAsgParams.json

    You receive the ID of the new RFC in the response and can use it to submit and monitor the RFC. Until you submit it, the RFC remains in the editing state and does not start.

Note

You can add up to 50 tags, but to do so you must enable the Additional configuration view.

To learn more, see Amazon Auto Scaling.

Execution Input Parameters

For detailed information about the execution input parameters, see Schema for Change Type ct-2tylseo8rxfsc.

Example: Required Parameters

{ "Description": "This is a test description", "VpcId": "vpc-1234567890abcdef0", "StackTemplateId": "stm-suw38u40000000000", "Name": "Test Stack", "Tags": [ { "Key": "foo", "Value": "bar" }, { "Key": "testkey", "Value": "testvalue" } ], "TimeoutInMinutes": 60, "Parameters": { "ASGAmiId": "ami-1234567890abcdef0", "ASGSubnetIds": ["subnet-1234567890abcdef0", "subnet-1234567890abcdef1"] } }

Example: All Parameters

{ "Description": "This is a test description", "VpcId": "vpc-1234abcd", "StackTemplateId": "stm-suw38u40000000000", "Name": "Test Stack", "Tags": [ { "Key": "foo", "Value": "bar" }, { "Key": "testkey", "Value": "testvalue" } ], "TimeoutInMinutes": 60, "Parameters": { "ASGAmiId": "ami-12345678", "ASGCooldown": 300, "ASGDesiredCapacity": 1, "ASGEBSOptimized": false, "ASGIAMInstanceProfile": "customer-mc-ec2-instance-profile", "ASGInstanceDetailedMonitoring": false, "ASGInstanceRootVolumeIops": 0, "ASGInstanceRootVolumeName": "/dev/xvda", "ASGInstanceRootVolumeSize": 8, "ASGInstanceRootVolumeType": "standard", "ASGInstanceType": "m3.medium", "ASGLoadBalancerNames": ["elb1"], "ASGMaxInstances": 1, "ASGMinInstances": 1, "ASGHealthCheckGracePeriod": 600, "ASGHealthCheckType":"EC2", "ASGScaleDownMetricName": "CPUUtilization", "ASGScaleDownPolicyCooldown": 300, "ASGScaleDownPolicyEvaluationPeriods": 4, "ASGScaleDownPolicyPeriod": 60, "ASGScaleDownPolicyScalingAdjustment": -1, "ASGScaleDownPolicyStatistic": "Average", "ASGScaleDownPolicyThreshold": 35, "ASGScaleUpMetricName": "CPUUtilization", "ASGScaleUpPolicyCooldown": 60, "ASGScaleUpPolicyEvaluationPeriods": 2, "ASGScaleUpPolicyPeriod": 60, "ASGScaleUpPolicyScalingAdjustment": 2, "ASGScaleUpPolicyStatistic": "Average", "ASGScaleUpPolicyThreshold": 75, "ASGSubnetIds": ["subnet-1234abcd", "subnet-1a2b3c4d"], "ASGUserData": "pwd\nls -ltrh\necho \"Hello, World\"" } }