Auto Scaling 2011-01-01
- Client: Aws\AutoScaling\AutoScalingClient
- Service ID: autoscaling
- Version: 2011-01-01
This page describes the parameters and results for the operations of the Auto Scaling (2011-01-01), and shows how to use the Aws\AutoScaling\AutoScalingClient object to call the described operations. This documentation is specific to the 2011-01-01 API version of the service.
Operation Summary
Each of the following operations can be created from a client using
$client->getCommand('CommandName')
, where "CommandName" is the
name of one of the following operations. Note: a command is a value that
encapsulates an operation and the parameters used to create an HTTP request.
You can also create and send a command immediately using the magic methods
available on a client object: $client->commandName(/* parameters */)
.
You can send the command asynchronously (returning a promise) by appending the
word "Async" to the operation name: $client->commandNameAsync(/* parameters */)
.
- AttachInstances ( array $params = [] )
Attaches one or more EC2 instances to the specified Auto Scaling group.
- AttachLoadBalancerTargetGroups ( array $params = [] )
Attaches one or more target groups to the specified Auto Scaling group.
- AttachLoadBalancers ( array $params = [] )
Attaches one or more Classic Load Balancers to the specified Auto Scaling group.
- BatchDeleteScheduledAction ( array $params = [] )
Deletes one or more scheduled actions for the specified Auto Scaling group.
- BatchPutScheduledUpdateGroupAction ( array $params = [] )
Creates or updates one or more scheduled scaling actions for an Auto Scaling group.
- CompleteLifecycleAction ( array $params = [] )
Completes the lifecycle action for the specified token or instance with the specified result.
- CreateAutoScalingGroup ( array $params = [] )
Creates an Auto Scaling group with the specified name and attributes.
- CreateLaunchConfiguration ( array $params = [] )
Creates a launch configuration.
- CreateOrUpdateTags ( array $params = [] )
Creates or updates tags for the specified Auto Scaling group.
- DeleteAutoScalingGroup ( array $params = [] )
Deletes the specified Auto Scaling group.
- DeleteLaunchConfiguration ( array $params = [] )
Deletes the specified launch configuration.
- DeleteLifecycleHook ( array $params = [] )
Deletes the specified lifecycle hook.
- DeleteNotificationConfiguration ( array $params = [] )
Deletes the specified notification.
- DeletePolicy ( array $params = [] )
Deletes the specified scaling policy.
- DeleteScheduledAction ( array $params = [] )
Deletes the specified scheduled action.
- DeleteTags ( array $params = [] )
Deletes the specified tags.
- DescribeAccountLimits ( array $params = [] )
Describes the current Amazon EC2 Auto Scaling resource limits for your AWS account.
- DescribeAdjustmentTypes ( array $params = [] )
Describes the policy adjustment types for use with PutScalingPolicy.
- DescribeAutoScalingGroups ( array $params = [] )
Describes one or more Auto Scaling groups.
- DescribeAutoScalingInstances ( array $params = [] )
Describes one or more Auto Scaling instances.
- DescribeAutoScalingNotificationTypes ( array $params = [] )
Describes the notification types that are supported by Amazon EC2 Auto Scaling.
- DescribeLaunchConfigurations ( array $params = [] )
Describes one or more launch configurations.
- DescribeLifecycleHookTypes ( array $params = [] )
Describes the available types of lifecycle hooks.
- DescribeLifecycleHooks ( array $params = [] )
Describes the lifecycle hooks for the specified Auto Scaling group.
- DescribeLoadBalancerTargetGroups ( array $params = [] )
Describes the target groups for the specified Auto Scaling group.
- DescribeLoadBalancers ( array $params = [] )
Describes the load balancers for the specified Auto Scaling group.
- DescribeMetricCollectionTypes ( array $params = [] )
Describes the available CloudWatch metrics for Amazon EC2 Auto Scaling.
- DescribeNotificationConfigurations ( array $params = [] )
Describes the notification actions associated with the specified Auto Scaling group.
- DescribePolicies ( array $params = [] )
Describes the policies for the specified Auto Scaling group.
- DescribeScalingActivities ( array $params = [] )
Describes one or more scaling activities for the specified Auto Scaling group.
- DescribeScalingProcessTypes ( array $params = [] )
Describes the scaling process types for use with ResumeProcesses and SuspendProcesses.
- DescribeScheduledActions ( array $params = [] )
Describes the actions scheduled for your Auto Scaling group that haven't run or that have not reached their end time.
- DescribeTags ( array $params = [] )
Describes the specified tags.
- DescribeTerminationPolicyTypes ( array $params = [] )
Describes the termination policies supported by Amazon EC2 Auto Scaling.
- DetachInstances ( array $params = [] )
Removes one or more instances from the specified Auto Scaling group.
- DetachLoadBalancerTargetGroups ( array $params = [] )
Detaches one or more target groups from the specified Auto Scaling group.
- DetachLoadBalancers ( array $params = [] )
Detaches one or more Classic Load Balancers from the specified Auto Scaling group.
- DisableMetricsCollection ( array $params = [] )
Disables group metrics for the specified Auto Scaling group.
- EnableMetricsCollection ( array $params = [] )
Enables group metrics for the specified Auto Scaling group.
- EnterStandby ( array $params = [] )
Moves the specified instances into the standby state.
- ExecutePolicy ( array $params = [] )
Executes the specified policy.
- ExitStandby ( array $params = [] )
Moves the specified instances out of the standby state.
- PutLifecycleHook ( array $params = [] )
Creates or updates a lifecycle hook for the specified Auto Scaling group.
- PutNotificationConfiguration ( array $params = [] )
Configures an Auto Scaling group to send notifications when specified events take place.
- PutScalingPolicy ( array $params = [] )
Creates or updates a scaling policy for an Auto Scaling group.
- PutScheduledUpdateGroupAction ( array $params = [] )
Creates or updates a scheduled scaling action for an Auto Scaling group.
- RecordLifecycleActionHeartbeat ( array $params = [] )
Records a heartbeat for the lifecycle action associated with the specified token or instance.
- ResumeProcesses ( array $params = [] )
Resumes the specified suspended automatic scaling processes, or all suspended process, for the specified Auto Scaling group.
- SetDesiredCapacity ( array $params = [] )
Sets the size of the specified Auto Scaling group.
- SetInstanceHealth ( array $params = [] )
Sets the health status of the specified instance.
- SetInstanceProtection ( array $params = [] )
Updates the instance protection settings of the specified instances.
- SuspendProcesses ( array $params = [] )
Suspends the specified automatic scaling processes, or all processes, for the specified Auto Scaling group.
- TerminateInstanceInAutoScalingGroup ( array $params = [] )
Terminates the specified instance and optionally adjusts the desired group size.
- UpdateAutoScalingGroup ( array $params = [] )
Updates the configuration for the specified Auto Scaling group.
Paginators
Paginators handle automatically iterating over paginated API results. Paginators are associated with specific API operations, and they accept the parameters that the corresponding API operation accepts. You can get a paginator from a client class using getPaginator($paginatorName, $operationParameters). This client supports the following paginators:
Waiters
Waiters allow you to poll a resource until it enters into a desired state. A waiter has a name used to describe what it does, and is associated with an API operation. When creating a waiter, you can provide the API operation parameters associated with the corresponding operation. Waiters can be accessed using the getWaiter($waiterName, $operationParameters) method of a client object. This client supports the following waiters:
Waiter name | API Operation | Delay | Max Attempts |
---|---|---|---|
GroupExists | DescribeAutoScalingGroups | 5 | 10 |
GroupInService | DescribeAutoScalingGroups | 15 | 40 |
GroupNotExists | DescribeAutoScalingGroups | 15 | 40 |
Operations
AttachInstances
$result = $client->attachInstances
([/* ... */]); $promise = $client->attachInstancesAsync
([/* ... */]);
Attaches one or more EC2 instances to the specified Auto Scaling group.
When you attach instances, Amazon EC2 Auto Scaling increases the desired capacity of the group by the number of instances being attached. If the number of instances being attached plus the desired capacity of the group exceeds the maximum size of the group, the operation fails.
If there is a Classic Load Balancer attached to your Auto Scaling group, the instances are also registered with the load balancer. If there are target groups attached to your Auto Scaling group, the instances are also registered with the target groups.
For more information, see Attach EC2 Instances to Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->attachInstances([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'InstanceIds' => ['<string>', ...], ]);
Parameter Details
Members
Result Syntax
[]
Result Details
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
-
The service-linked role is not yet ready for use.
Examples
Example 1: To attach an instance to an Auto Scaling group
This example attaches the specified instance to the specified Auto Scaling group.
$result = $client->attachInstances([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'InstanceIds' => [ 'i-93633f9b', ], ]);
AttachLoadBalancerTargetGroups
$result = $client->attachLoadBalancerTargetGroups
([/* ... */]); $promise = $client->attachLoadBalancerTargetGroupsAsync
([/* ... */]);
Attaches one or more target groups to the specified Auto Scaling group.
To describe the target groups for an Auto Scaling group, use DescribeLoadBalancerTargetGroups. To detach the target group from the Auto Scaling group, use DetachLoadBalancerTargetGroups.
With Application Load Balancers and Network Load Balancers, instances are registered as targets with a target group. With Classic Load Balancers, instances are registered with the load balancer. For more information, see Attaching a Load Balancer to Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->attachLoadBalancerTargetGroups([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'TargetGroupARNs' => ['<string>', ...], // REQUIRED ]);
Parameter Details
Members
Result Syntax
[]
Result Details
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
-
The service-linked role is not yet ready for use.
Examples
Example 1: To attach a target group to an Auto Scaling group
This example attaches the specified target group to the specified Auto Scaling group.
$result = $client->attachLoadBalancerTargetGroups([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'TargetGroupARNs' => [ 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067', ], ]);
AttachLoadBalancers
$result = $client->attachLoadBalancers
([/* ... */]); $promise = $client->attachLoadBalancersAsync
([/* ... */]);
Attaches one or more Classic Load Balancers to the specified Auto Scaling group.
To attach an Application Load Balancer or a Network Load Balancer instead, see AttachLoadBalancerTargetGroups.
To describe the load balancers for an Auto Scaling group, use DescribeLoadBalancers. To detach the load balancer from the Auto Scaling group, use DetachLoadBalancers.
For more information, see Attaching a Load Balancer to Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->attachLoadBalancers([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'LoadBalancerNames' => ['<string>', ...], // REQUIRED ]);
Parameter Details
Members
Result Syntax
[]
Result Details
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
-
The service-linked role is not yet ready for use.
Examples
Example 1: To attach a load balancer to an Auto Scaling group
This example attaches the specified load balancer to the specified Auto Scaling group.
$result = $client->attachLoadBalancers([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'LoadBalancerNames' => [ 'my-load-balancer', ], ]);
BatchDeleteScheduledAction
$result = $client->batchDeleteScheduledAction
([/* ... */]); $promise = $client->batchDeleteScheduledActionAsync
([/* ... */]);
Deletes one or more scheduled actions for the specified Auto Scaling group.
Parameter Syntax
$result = $client->batchDeleteScheduledAction([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'ScheduledActionNames' => ['<string>', ...], // REQUIRED ]);
Parameter Details
Members
Result Syntax
[ 'FailedScheduledActions' => [ [ 'ErrorCode' => '<string>', 'ErrorMessage' => '<string>', 'ScheduledActionName' => '<string>', ], // ... ], ]
Result Details
Members
- FailedScheduledActions
-
- Type: Array of FailedScheduledUpdateGroupActionRequest structures
The names of the scheduled actions that could not be deleted, including an error message.
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
BatchPutScheduledUpdateGroupAction
$result = $client->batchPutScheduledUpdateGroupAction
([/* ... */]); $promise = $client->batchPutScheduledUpdateGroupActionAsync
([/* ... */]);
Creates or updates one or more scheduled scaling actions for an Auto Scaling group. If you leave a parameter unspecified when updating a scheduled scaling action, the corresponding value remains unchanged.
Parameter Syntax
$result = $client->batchPutScheduledUpdateGroupAction([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'ScheduledUpdateGroupActions' => [ // REQUIRED [ 'DesiredCapacity' => <integer>, 'EndTime' => <integer || string || DateTime>, 'MaxSize' => <integer>, 'MinSize' => <integer>, 'Recurrence' => '<string>', 'ScheduledActionName' => '<string>', // REQUIRED 'StartTime' => <integer || string || DateTime>, ], // ... ], ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- ScheduledUpdateGroupActions
-
- Required: Yes
- Type: Array of ScheduledUpdateGroupActionRequest structures
One or more scheduled actions. The maximum number allowed is 50.
Result Syntax
[ 'FailedScheduledUpdateGroupActions' => [ [ 'ErrorCode' => '<string>', 'ErrorMessage' => '<string>', 'ScheduledActionName' => '<string>', ], // ... ], ]
Result Details
Members
- FailedScheduledUpdateGroupActions
-
- Type: Array of FailedScheduledUpdateGroupActionRequest structures
The names of the scheduled actions that could not be created or updated, including an error message.
Errors
-
You already have an Auto Scaling group or launch configuration with this name.
-
You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits.
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
CompleteLifecycleAction
$result = $client->completeLifecycleAction
([/* ... */]); $promise = $client->completeLifecycleActionAsync
([/* ... */]);
Completes the lifecycle action for the specified token or instance with the specified result.
This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:
-
(Optional) Create a Lambda function and a rule that allows CloudWatch Events to invoke your Lambda function when Amazon EC2 Auto Scaling launches or terminates instances.
-
(Optional) Create a notification target and an IAM role. The target can be either an Amazon SQS queue or an Amazon SNS topic. The role allows Amazon EC2 Auto Scaling to publish lifecycle notifications to the target.
-
Create the lifecycle hook. Specify whether the hook is used when the instances launch or terminate.
-
If you need more time, record the lifecycle action heartbeat to keep the instance in a pending state.
-
If you finish before the timeout period ends, complete the lifecycle action.
For more information, see Amazon EC2 Auto Scaling Lifecycle Hooks in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->completeLifecycleAction([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'InstanceId' => '<string>', 'LifecycleActionResult' => '<string>', // REQUIRED 'LifecycleActionToken' => '<string>', 'LifecycleHookName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- InstanceId
-
- Type: string
The ID of the instance.
- LifecycleActionResult
-
- Required: Yes
- Type: string
The action for the group to take. This parameter can be either
CONTINUE
orABANDON
. - LifecycleActionToken
-
- Type: string
A universally unique identifier (UUID) that identifies a specific lifecycle action associated with an instance. Amazon EC2 Auto Scaling sends this token to the notification target you specified when you created the lifecycle hook.
- LifecycleHookName
-
- Required: Yes
- Type: string
The name of the lifecycle hook.
Result Syntax
[]
Result Details
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To complete the lifecycle action
This example notifies Auto Scaling that the specified lifecycle action is complete so that it can finish launching or terminating the instance.
$result = $client->completeLifecycleAction([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'LifecycleActionResult' => 'CONTINUE', 'LifecycleActionToken' => 'bcd2f1b8-9a78-44d3-8a7a-4dd07d7cf635', 'LifecycleHookName' => 'my-lifecycle-hook', ]);
CreateAutoScalingGroup
$result = $client->createAutoScalingGroup
([/* ... */]); $promise = $client->createAutoScalingGroupAsync
([/* ... */]);
Creates an Auto Scaling group with the specified name and attributes.
If you exceed your maximum limit of Auto Scaling groups, the call fails. For information about viewing this limit, see DescribeAccountLimits. For information about updating this limit, see Amazon EC2 Auto Scaling Limits in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->createAutoScalingGroup([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'AvailabilityZones' => ['<string>', ...], 'DefaultCooldown' => <integer>, 'DesiredCapacity' => <integer>, 'HealthCheckGracePeriod' => <integer>, 'HealthCheckType' => '<string>', 'InstanceId' => '<string>', 'LaunchConfigurationName' => '<string>', 'LaunchTemplate' => [ 'LaunchTemplateId' => '<string>', 'LaunchTemplateName' => '<string>', 'Version' => '<string>', ], 'LifecycleHookSpecificationList' => [ [ 'DefaultResult' => '<string>', 'HeartbeatTimeout' => <integer>, 'LifecycleHookName' => '<string>', // REQUIRED 'LifecycleTransition' => '<string>', // REQUIRED 'NotificationMetadata' => '<string>', 'NotificationTargetARN' => '<string>', 'RoleARN' => '<string>', ], // ... ], 'LoadBalancerNames' => ['<string>', ...], 'MaxInstanceLifetime' => <integer>, 'MaxSize' => <integer>, // REQUIRED 'MinSize' => <integer>, // REQUIRED 'MixedInstancesPolicy' => [ 'InstancesDistribution' => [ 'OnDemandAllocationStrategy' => '<string>', 'OnDemandBaseCapacity' => <integer>, 'OnDemandPercentageAboveBaseCapacity' => <integer>, 'SpotAllocationStrategy' => '<string>', 'SpotInstancePools' => <integer>, 'SpotMaxPrice' => '<string>', ], 'LaunchTemplate' => [ 'LaunchTemplateSpecification' => [ 'LaunchTemplateId' => '<string>', 'LaunchTemplateName' => '<string>', 'Version' => '<string>', ], 'Overrides' => [ [ 'InstanceType' => '<string>', 'WeightedCapacity' => '<string>', ], // ... ], ], ], 'NewInstancesProtectedFromScaleIn' => true || false, 'PlacementGroup' => '<string>', 'ServiceLinkedRoleARN' => '<string>', 'Tags' => [ [ 'Key' => '<string>', // REQUIRED 'PropagateAtLaunch' => true || false, 'ResourceId' => '<string>', 'ResourceType' => '<string>', 'Value' => '<string>', ], // ... ], 'TargetGroupARNs' => ['<string>', ...], 'TerminationPolicies' => ['<string>', ...], 'VPCZoneIdentifier' => '<string>', ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group. This name must be unique per Region per account.
- AvailabilityZones
-
- Type: Array of strings
One or more Availability Zones for the group. This parameter is optional if you specify one or more subnets for
VPCZoneIdentifier
.Conditional: If your account supports EC2-Classic and VPC, this parameter is required to launch instances into EC2-Classic.
- DefaultCooldown
-
- Type: int
The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. The default value is
300
.For more information, see Scaling Cooldowns in the Amazon EC2 Auto Scaling User Guide.
- DesiredCapacity
-
- Type: int
The number of Amazon EC2 instances that the Auto Scaling group attempts to maintain. This number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group. If you do not specify a desired capacity, the default is the minimum size of the group.
- HealthCheckGracePeriod
-
- Type: int
The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an EC2 instance that has come into service. During this time, any health check failures for the instance are ignored. The default value is
0
.For more information, see Health Check Grace Period in the Amazon EC2 Auto Scaling User Guide.
Conditional: This parameter is required if you are adding an
ELB
health check. - HealthCheckType
-
- Type: string
The service to use for the health checks. The valid values are
EC2
andELB
. The default value isEC2
. If you configure an Auto Scaling group to use ELB health checks, it considers the instance unhealthy if it fails either the EC2 status checks or the load balancer health checks.For more information, see Health Checks for Auto Scaling Instances in the Amazon EC2 Auto Scaling User Guide.
- InstanceId
-
- Type: string
The ID of the instance used to create a launch configuration for the group.
When you specify an ID of an instance, Amazon EC2 Auto Scaling creates a new launch configuration and associates it with the group. This launch configuration derives its attributes from the specified instance, except for the block device mapping.
For more information, see Create an Auto Scaling Group Using an EC2 Instance in the Amazon EC2 Auto Scaling User Guide.
You must specify one of the following parameters in your request:
LaunchConfigurationName
,LaunchTemplate
,InstanceId
, orMixedInstancesPolicy
. - LaunchConfigurationName
-
- Type: string
The name of the launch configuration.
If you do not specify
LaunchConfigurationName
, you must specify one of the following parameters:InstanceId
,LaunchTemplate
, orMixedInstancesPolicy
. - LaunchTemplate
-
- Type: LaunchTemplateSpecification structure
The launch template to use to launch instances.
For more information, see LaunchTemplateSpecification in the Amazon EC2 Auto Scaling API Reference.
If you do not specify
LaunchTemplate
, you must specify one of the following parameters:InstanceId
,LaunchConfigurationName
, orMixedInstancesPolicy
. - LifecycleHookSpecificationList
-
- Type: Array of LifecycleHookSpecification structures
One or more lifecycle hooks.
- LoadBalancerNames
-
- Type: Array of strings
A list of Classic Load Balancers associated with this Auto Scaling group. For Application Load Balancers and Network Load Balancers, specify a list of target groups using the
TargetGroupARNs
property instead.For more information, see Using a Load Balancer with an Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide.
- MaxInstanceLifetime
-
- Type: int
The maximum amount of time, in seconds, that an instance can be in service.
Valid Range: Minimum value of 604800.
- MaxSize
-
- Required: Yes
- Type: int
The maximum size of the group.
- MinSize
-
- Required: Yes
- Type: int
The minimum size of the group.
- MixedInstancesPolicy
-
- Type: MixedInstancesPolicy structure
An embedded object that specifies a mixed instances policy. The required parameters must be specified. If optional parameters are unspecified, their default values are used.
The policy includes parameters that not only define the distribution of On-Demand Instances and Spot Instances, the maximum price to pay for Spot Instances, and how the Auto Scaling group allocates instance types to fulfill On-Demand and Spot capacity, but also the parameters that specify the instance configuration information—the launch template and instance types.
For more information, see MixedInstancesPolicy in the Amazon EC2 Auto Scaling API Reference and Auto Scaling Groups with Multiple Instance Types and Purchase Options in the Amazon EC2 Auto Scaling User Guide.
You must specify one of the following parameters in your request:
LaunchConfigurationName
,LaunchTemplate
,InstanceId
, orMixedInstancesPolicy
. - NewInstancesProtectedFromScaleIn
-
- Type: boolean
Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.
For more information about preventing instances from terminating on scale in, see Instance Protection in the Amazon EC2 Auto Scaling User Guide.
- PlacementGroup
-
- Type: string
The name of the placement group into which to launch your instances, if any. A placement group is a logical grouping of instances within a single Availability Zone. You cannot specify multiple Availability Zones and a placement group. For more information, see Placement Groups in the Amazon EC2 User Guide for Linux Instances.
- ServiceLinkedRoleARN
-
- Type: string
The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other AWS services on your behalf. By default, Amazon EC2 Auto Scaling uses a service-linked role named AWSServiceRoleForAutoScaling, which it creates if it does not exist. For more information, see Service-Linked Roles in the Amazon EC2 Auto Scaling User Guide.
- Tags
-
- Type: Array of Tag structures
One or more tags.
For more information, see Tagging Auto Scaling Groups and Instances in the Amazon EC2 Auto Scaling User Guide.
- TargetGroupARNs
-
- Type: Array of strings
The Amazon Resource Names (ARN) of the target groups to associate with the Auto Scaling group. Instances are registered as targets in a target group, and traffic is routed to the target group.
For more information, see Using a Load Balancer with an Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide.
- TerminationPolicies
-
- Type: Array of strings
One or more termination policies used to select the instance to terminate. These policies are executed in the order that they are listed.
For more information, see Controlling Which Instances Auto Scaling Terminates During Scale In in the Amazon EC2 Auto Scaling User Guide.
- VPCZoneIdentifier
-
- Type: string
A comma-separated list of subnet IDs for your virtual private cloud (VPC).
If you specify
VPCZoneIdentifier
withAvailabilityZones
, the subnets that you specify for this parameter must reside in those Availability Zones.Conditional: If your account supports EC2-Classic and VPC, this parameter is required to launch instances into a VPC.
Result Syntax
[]
Result Details
Errors
-
You already have an Auto Scaling group or launch configuration with this name.
-
You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits.
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
-
The service-linked role is not yet ready for use.
Examples
Example 1: To create an Auto Scaling group
This example creates an Auto Scaling group.
$result = $client->createAutoScalingGroup([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'LaunchConfigurationName' => 'my-launch-config', 'MaxSize' => 3, 'MinSize' => 1, 'VPCZoneIdentifier' => 'subnet-4176792c', ]);
Example 2: To create an Auto Scaling group with an attached load balancer
This example creates an Auto Scaling group and attaches the specified Classic Load Balancer.
$result = $client->createAutoScalingGroup([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'AvailabilityZones' => [ 'us-west-2c', ], 'HealthCheckGracePeriod' => 120, 'HealthCheckType' => 'ELB', 'LaunchConfigurationName' => 'my-launch-config', 'LoadBalancerNames' => [ 'my-load-balancer', ], 'MaxSize' => 3, 'MinSize' => 1, ]);
Example 3: To create an Auto Scaling group with an attached target group
This example creates an Auto Scaling group and attaches the specified target group.
$result = $client->createAutoScalingGroup([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'HealthCheckGracePeriod' => 120, 'HealthCheckType' => 'ELB', 'LaunchConfigurationName' => 'my-launch-config', 'MaxSize' => 3, 'MinSize' => 1, 'TargetGroupARNs' => [ 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067', ], 'VPCZoneIdentifier' => 'subnet-4176792c, subnet-65ea5f08', ]);
CreateLaunchConfiguration
$result = $client->createLaunchConfiguration
([/* ... */]); $promise = $client->createLaunchConfigurationAsync
([/* ... */]);
Creates a launch configuration.
If you exceed your maximum limit of launch configurations, the call fails. For information about viewing this limit, see DescribeAccountLimits. For information about updating this limit, see Amazon EC2 Auto Scaling Limits in the Amazon EC2 Auto Scaling User Guide.
For more information, see Launch Configurations in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->createLaunchConfiguration([ 'AssociatePublicIpAddress' => true || false, 'BlockDeviceMappings' => [ [ 'DeviceName' => '<string>', // REQUIRED 'Ebs' => [ 'DeleteOnTermination' => true || false, 'Encrypted' => true || false, 'Iops' => <integer>, 'SnapshotId' => '<string>', 'VolumeSize' => <integer>, 'VolumeType' => '<string>', ], 'NoDevice' => true || false, 'VirtualName' => '<string>', ], // ... ], 'ClassicLinkVPCId' => '<string>', 'ClassicLinkVPCSecurityGroups' => ['<string>', ...], 'EbsOptimized' => true || false, 'IamInstanceProfile' => '<string>', 'ImageId' => '<string>', 'InstanceId' => '<string>', 'InstanceMonitoring' => [ 'Enabled' => true || false, ], 'InstanceType' => '<string>', 'KernelId' => '<string>', 'KeyName' => '<string>', 'LaunchConfigurationName' => '<string>', // REQUIRED 'PlacementTenancy' => '<string>', 'RamdiskId' => '<string>', 'SecurityGroups' => ['<string>', ...], 'SpotPrice' => '<string>', 'UserData' => '<string>', ]);
Parameter Details
Members
- AssociatePublicIpAddress
-
- Type: boolean
For Auto Scaling groups that are running in a virtual private cloud (VPC), specifies whether to assign a public IP address to the group's instances. If you specify
true
, each instance in the Auto Scaling group receives a unique public IP address. For more information, see Launching Auto Scaling Instances in a VPC in the Amazon EC2 Auto Scaling User Guide.If you specify this parameter, you must specify at least one subnet for
VPCZoneIdentifier
when you create your group.If the instance is launched into a default subnet, the default is to assign a public IP address, unless you disabled the option to assign a public IP address on the subnet. If the instance is launched into a nondefault subnet, the default is not to assign a public IP address, unless you enabled the option to assign a public IP address on the subnet.
- BlockDeviceMappings
-
- Type: Array of BlockDeviceMapping structures
A block device mapping, which specifies the block devices for the instance. You can specify virtual devices and EBS volumes. For more information, see Block Device Mapping in the Amazon EC2 User Guide for Linux Instances.
- ClassicLinkVPCId
-
- Type: string
The ID of a ClassicLink-enabled VPC to link your EC2-Classic instances to. For more information, see ClassicLink in the Amazon EC2 User Guide for Linux Instances and Linking EC2-Classic Instances to a VPC in the Amazon EC2 Auto Scaling User Guide.
This parameter can only be used if you are launching EC2-Classic instances.
- ClassicLinkVPCSecurityGroups
-
- Type: Array of strings
The IDs of one or more security groups for the specified ClassicLink-enabled VPC. For more information, see ClassicLink in the Amazon EC2 User Guide for Linux Instances and Linking EC2-Classic Instances to a VPC in the Amazon EC2 Auto Scaling User Guide.
If you specify the
ClassicLinkVPCId
parameter, you must specify this parameter. - EbsOptimized
-
- Type: boolean
Specifies whether the launch configuration is optimized for EBS I/O (
true
) or not (false
). The optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal I/O performance. This optimization is not available with all instance types. Additional fees are incurred when you enable EBS optimization for an instance type that is not EBS-optimized by default. For more information, see Amazon EBS-Optimized Instances in the Amazon EC2 User Guide for Linux Instances.The default value is
false
. - IamInstanceProfile
-
- Type: string
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.
For more information, see IAM Role for Applications That Run on Amazon EC2 Instances in the Amazon EC2 Auto Scaling User Guide.
- ImageId
-
- Type: string
The ID of the Amazon Machine Image (AMI) that was assigned during registration. For more information, see Finding an AMI in the Amazon EC2 User Guide for Linux Instances.
If you do not specify
InstanceId
, you must specifyImageId
. - InstanceId
-
- Type: string
The ID of the instance to use to create the launch configuration. The new launch configuration derives attributes from the instance, except for the block device mapping.
To create a launch configuration with a block device mapping or override any other instance attributes, specify them as part of the same request.
For more information, see Create a Launch Configuration Using an EC2 Instance in the Amazon EC2 Auto Scaling User Guide.
If you do not specify
InstanceId
, you must specify bothImageId
andInstanceType
. - InstanceMonitoring
-
- Type: InstanceMonitoring structure
Controls whether instances in this group are launched with detailed (
true
) or basic (false
) monitoring.The default value is
true
(enabled).When detailed monitoring is enabled, Amazon CloudWatch generates metrics every minute and your account is charged a fee. When you disable detailed monitoring, CloudWatch generates metrics every 5 minutes. For more information, see Configure Monitoring for Auto Scaling Instances in the Amazon EC2 Auto Scaling User Guide.
- InstanceType
-
- Type: string
Specifies the instance type of the EC2 instance.
For information about available instance types, see Available Instance Types in the Amazon EC2 User Guide for Linux Instances.
If you do not specify
InstanceId
, you must specifyInstanceType
. - KernelId
-
- Type: string
The ID of the kernel associated with the AMI.
- KeyName
-
- Type: string
The name of the key pair. For more information, see Amazon EC2 Key Pairs in the Amazon EC2 User Guide for Linux Instances.
- LaunchConfigurationName
-
- Required: Yes
- Type: string
The name of the launch configuration. This name must be unique per Region per account.
- PlacementTenancy
-
- Type: string
The tenancy of the instance. An instance with
dedicated
tenancy runs on isolated, single-tenant hardware and can only be launched into a VPC.To launch dedicated instances into a shared tenancy VPC (a VPC with the instance placement tenancy attribute set to
default
), you must set the value of this parameter todedicated
.If you specify
PlacementTenancy
, you must specify at least one subnet forVPCZoneIdentifier
when you create your group.For more information, see Instance Placement Tenancy in the Amazon EC2 Auto Scaling User Guide.
Valid Values:
default
|dedicated
- RamdiskId
-
- Type: string
The ID of the RAM disk to select.
- SecurityGroups
-
- Type: Array of strings
A list that contains the security groups to assign to the instances in the Auto Scaling group.
[EC2-VPC] Specify the security group IDs. For more information, see Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide.
[EC2-Classic] Specify either the security group names or the security group IDs. For more information, see Amazon EC2 Security Groups in the Amazon EC2 User Guide for Linux Instances.
- SpotPrice
-
- Type: string
The maximum hourly price to be paid for any Spot Instance launched to fulfill the request. Spot Instances are launched when the price you specify exceeds the current Spot price. For more information, see Launching Spot Instances in Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide.
When you change your maximum price by creating a new launch configuration, running instances will continue to run as long as the maximum price for those running instances is higher than the current Spot price.
- UserData
-
- Type: string
The Base64-encoded user data to make available to the launched EC2 instances. For more information, see Instance Metadata and User Data in the Amazon EC2 User Guide for Linux Instances.
Result Syntax
[]
Result Details
Errors
-
You already have an Auto Scaling group or launch configuration with this name.
-
You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits.
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To create a launch configuration
This example creates a launch configuration.
$result = $client->createLaunchConfiguration([ 'IamInstanceProfile' => 'my-iam-role', 'ImageId' => 'ami-12345678', 'InstanceType' => 'm3.medium', 'LaunchConfigurationName' => 'my-launch-config', 'SecurityGroups' => [ 'sg-eb2af88e', ], ]);
CreateOrUpdateTags
$result = $client->createOrUpdateTags
([/* ... */]); $promise = $client->createOrUpdateTagsAsync
([/* ... */]);
Creates or updates tags for the specified Auto Scaling group.
When you specify a tag with a key that already exists, the operation overwrites the previous tag definition, and you do not get an error message.
For more information, see Tagging Auto Scaling Groups and Instances in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->createOrUpdateTags([ 'Tags' => [ // REQUIRED [ 'Key' => '<string>', // REQUIRED 'PropagateAtLaunch' => true || false, 'ResourceId' => '<string>', 'ResourceType' => '<string>', 'Value' => '<string>', ], // ... ], ]);
Parameter Details
Members
- Tags
-
- Required: Yes
- Type: Array of Tag structures
One or more tags.
Result Syntax
[]
Result Details
Errors
-
You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits.
-
You already have an Auto Scaling group or launch configuration with this name.
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
-
The operation can't be performed because the resource is in use.
Examples
Example 1: To create or update tags for an Auto Scaling group
This example adds two tags to the specified Auto Scaling group.
$result = $client->createOrUpdateTags([ 'Tags' => [ [ 'Key' => 'Role', 'PropagateAtLaunch' => 1, 'ResourceId' => 'my-auto-scaling-group', 'ResourceType' => 'auto-scaling-group', 'Value' => 'WebServer', ], [ 'Key' => 'Dept', 'PropagateAtLaunch' => 1, 'ResourceId' => 'my-auto-scaling-group', 'ResourceType' => 'auto-scaling-group', 'Value' => 'Research', ], ], ]);
DeleteAutoScalingGroup
$result = $client->deleteAutoScalingGroup
([/* ... */]); $promise = $client->deleteAutoScalingGroupAsync
([/* ... */]);
Deletes the specified Auto Scaling group.
If the group has instances or scaling activities in progress, you must specify the option to force the deletion in order for it to succeed.
If the group has policies, deleting the group deletes the policies, the underlying alarm actions, and any alarm that no longer has an associated action.
To remove instances from the Auto Scaling group before deleting it, call DetachInstances with the list of instances and the option to decrement the desired capacity. This ensures that Amazon EC2 Auto Scaling does not launch replacement instances.
To terminate all instances before deleting the Auto Scaling group, call UpdateAutoScalingGroup and set the minimum size and desired capacity of the Auto Scaling group to zero.
Parameter Syntax
$result = $client->deleteAutoScalingGroup([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'ForceDelete' => true || false, ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- ForceDelete
-
- Type: boolean
Specifies that the group is to be deleted along with all instances associated with the group, without waiting for all instances to be terminated. This parameter also deletes any lifecycle actions associated with the group.
Result Syntax
[]
Result Details
Errors
-
ScalingActivityInProgressFault:
The operation can't be performed because there are scaling activities in progress.
-
The operation can't be performed because the resource is in use.
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To delete an Auto Scaling group
This example deletes the specified Auto Scaling group.
$result = $client->deleteAutoScalingGroup([ 'AutoScalingGroupName' => 'my-auto-scaling-group', ]);
Example 2: To delete an Auto Scaling group and all its instances
This example deletes the specified Auto Scaling group and all its instances.
$result = $client->deleteAutoScalingGroup([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'ForceDelete' => 1, ]);
DeleteLaunchConfiguration
$result = $client->deleteLaunchConfiguration
([/* ... */]); $promise = $client->deleteLaunchConfigurationAsync
([/* ... */]);
Deletes the specified launch configuration.
The launch configuration must not be attached to an Auto Scaling group. When this call completes, the launch configuration is no longer available for use.
Parameter Syntax
$result = $client->deleteLaunchConfiguration([ 'LaunchConfigurationName' => '<string>', // REQUIRED ]);
Parameter Details
Result Syntax
[]
Result Details
Errors
-
The operation can't be performed because the resource is in use.
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To delete a launch configuration
This example deletes the specified launch configuration.
$result = $client->deleteLaunchConfiguration([ 'LaunchConfigurationName' => 'my-launch-config', ]);
DeleteLifecycleHook
$result = $client->deleteLifecycleHook
([/* ... */]); $promise = $client->deleteLifecycleHookAsync
([/* ... */]);
Deletes the specified lifecycle hook.
If there are any outstanding lifecycle actions, they are completed first (ABANDON
for launching instances, CONTINUE
for terminating instances).
Parameter Syntax
$result = $client->deleteLifecycleHook([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'LifecycleHookName' => '<string>', // REQUIRED ]);
Parameter Details
Members
Result Syntax
[]
Result Details
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To delete a lifecycle hook
This example deletes the specified lifecycle hook.
$result = $client->deleteLifecycleHook([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'LifecycleHookName' => 'my-lifecycle-hook', ]);
DeleteNotificationConfiguration
$result = $client->deleteNotificationConfiguration
([/* ... */]); $promise = $client->deleteNotificationConfigurationAsync
([/* ... */]);
Deletes the specified notification.
Parameter Syntax
$result = $client->deleteNotificationConfiguration([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'TopicARN' => '<string>', // REQUIRED ]);
Parameter Details
Members
Result Syntax
[]
Result Details
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To delete an Auto Scaling notification
This example deletes the specified notification from the specified Auto Scaling group.
$result = $client->deleteNotificationConfiguration([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'TopicARN' => 'arn:aws:sns:us-west-2:123456789012:my-sns-topic', ]);
DeletePolicy
$result = $client->deletePolicy
([/* ... */]); $promise = $client->deletePolicyAsync
([/* ... */]);
Deletes the specified scaling policy.
Deleting either a step scaling policy or a simple scaling policy deletes the underlying alarm action, but does not delete the alarm, even if it no longer has an associated action.
For more information, see Deleting a Scaling Policy in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->deletePolicy([ 'AutoScalingGroupName' => '<string>', 'PolicyName' => '<string>', // REQUIRED ]);
Parameter Details
Members
Result Syntax
[]
Result Details
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
-
The service-linked role is not yet ready for use.
Examples
Example 1: To delete an Auto Scaling policy
This example deletes the specified Auto Scaling policy.
$result = $client->deletePolicy([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'PolicyName' => 'ScaleIn', ]);
DeleteScheduledAction
$result = $client->deleteScheduledAction
([/* ... */]); $promise = $client->deleteScheduledActionAsync
([/* ... */]);
Deletes the specified scheduled action.
Parameter Syntax
$result = $client->deleteScheduledAction([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'ScheduledActionName' => '<string>', // REQUIRED ]);
Parameter Details
Members
Result Syntax
[]
Result Details
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To delete a scheduled action from an Auto Scaling group
This example deletes the specified scheduled action from the specified Auto Scaling group.
$result = $client->deleteScheduledAction([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'ScheduledActionName' => 'my-scheduled-action', ]);
DeleteTags
$result = $client->deleteTags
([/* ... */]); $promise = $client->deleteTagsAsync
([/* ... */]);
Deletes the specified tags.
Parameter Syntax
$result = $client->deleteTags([ 'Tags' => [ // REQUIRED [ 'Key' => '<string>', // REQUIRED 'PropagateAtLaunch' => true || false, 'ResourceId' => '<string>', 'ResourceType' => '<string>', 'Value' => '<string>', ], // ... ], ]);
Parameter Details
Members
- Tags
-
- Required: Yes
- Type: Array of Tag structures
One or more tags.
Result Syntax
[]
Result Details
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
-
The operation can't be performed because the resource is in use.
Examples
Example 1: To delete a tag from an Auto Scaling group
This example deletes the specified tag from the specified Auto Scaling group.
$result = $client->deleteTags([ 'Tags' => [ [ 'Key' => 'Dept', 'ResourceId' => 'my-auto-scaling-group', 'ResourceType' => 'auto-scaling-group', 'Value' => 'Research', ], ], ]);
DescribeAccountLimits
$result = $client->describeAccountLimits
([/* ... */]); $promise = $client->describeAccountLimitsAsync
([/* ... */]);
Describes the current Amazon EC2 Auto Scaling resource limits for your AWS account.
For information about requesting an increase in these limits, see Amazon EC2 Auto Scaling Limits in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->describeAccountLimits([ ]);
Parameter Details
Members
Result Syntax
[ 'MaxNumberOfAutoScalingGroups' => <integer>, 'MaxNumberOfLaunchConfigurations' => <integer>, 'NumberOfAutoScalingGroups' => <integer>, 'NumberOfLaunchConfigurations' => <integer>, ]
Result Details
Members
- MaxNumberOfAutoScalingGroups
-
- Type: int
The maximum number of groups allowed for your AWS account. The default limit is 200 per AWS Region.
- MaxNumberOfLaunchConfigurations
-
- Type: int
The maximum number of launch configurations allowed for your AWS account. The default limit is 200 per AWS Region.
- NumberOfAutoScalingGroups
-
- Type: int
The current number of groups for your AWS account.
- NumberOfLaunchConfigurations
-
- Type: int
The current number of launch configurations for your AWS account.
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To describe your Auto Scaling account limits
This example describes the Auto Scaling limits for your AWS account.
$result = $client->describeAccountLimits([ ]);
Result syntax:
[ 'MaxNumberOfAutoScalingGroups' => 20, 'MaxNumberOfLaunchConfigurations' => 100, 'NumberOfAutoScalingGroups' => 3, 'NumberOfLaunchConfigurations' => 5, ]
DescribeAdjustmentTypes
$result = $client->describeAdjustmentTypes
([/* ... */]); $promise = $client->describeAdjustmentTypesAsync
([/* ... */]);
Describes the policy adjustment types for use with PutScalingPolicy.
Parameter Syntax
$result = $client->describeAdjustmentTypes([ ]);
Parameter Details
Members
Result Syntax
[ 'AdjustmentTypes' => [ [ 'AdjustmentType' => '<string>', ], // ... ], ]
Result Details
Members
- AdjustmentTypes
-
- Type: Array of AdjustmentType structures
The policy adjustment types.
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To describe the Auto Scaling adjustment types
This example describes the available adjustment types.
$result = $client->describeAdjustmentTypes([ ]);
Result syntax:
[ 'AdjustmentTypes' => [ [ 'AdjustmentType' => 'ChangeInCapacity', ], [ 'AdjustmentType' => 'ExactCapcity', ], [ 'AdjustmentType' => 'PercentChangeInCapacity', ], ], ]
DescribeAutoScalingGroups
$result = $client->describeAutoScalingGroups
([/* ... */]); $promise = $client->describeAutoScalingGroupsAsync
([/* ... */]);
Describes one or more Auto Scaling groups.
Parameter Syntax
$result = $client->describeAutoScalingGroups([ 'AutoScalingGroupNames' => ['<string>', ...], 'MaxRecords' => <integer>, 'NextToken' => '<string>', ]);
Parameter Details
Members
- AutoScalingGroupNames
-
- Type: Array of strings
The names of the Auto Scaling groups. Each name can be a maximum of 1600 characters. By default, you can only specify up to 50 names. You can optionally increase this limit using the
MaxRecords
parameter.If you omit this parameter, all Auto Scaling groups are described.
- MaxRecords
-
- Type: int
The maximum number of items to return with this call. The default value is
50
and the maximum value is100
. - NextToken
-
- Type: string
The token for the next set of items to return. (You received this token from a previous call.)
Result Syntax
[ 'AutoScalingGroups' => [ [ 'AutoScalingGroupARN' => '<string>', 'AutoScalingGroupName' => '<string>', 'AvailabilityZones' => ['<string>', ...], 'CreatedTime' => <DateTime>, 'DefaultCooldown' => <integer>, 'DesiredCapacity' => <integer>, 'EnabledMetrics' => [ [ 'Granularity' => '<string>', 'Metric' => '<string>', ], // ... ], 'HealthCheckGracePeriod' => <integer>, 'HealthCheckType' => '<string>', 'Instances' => [ [ 'AvailabilityZone' => '<string>', 'HealthStatus' => '<string>', 'InstanceId' => '<string>', 'InstanceType' => '<string>', 'LaunchConfigurationName' => '<string>', 'LaunchTemplate' => [ 'LaunchTemplateId' => '<string>', 'LaunchTemplateName' => '<string>', 'Version' => '<string>', ], 'LifecycleState' => 'Pending|Pending:Wait|Pending:Proceed|Quarantined|InService|Terminating|Terminating:Wait|Terminating:Proceed|Terminated|Detaching|Detached|EnteringStandby|Standby', 'ProtectedFromScaleIn' => true || false, 'WeightedCapacity' => '<string>', ], // ... ], 'LaunchConfigurationName' => '<string>', 'LaunchTemplate' => [ 'LaunchTemplateId' => '<string>', 'LaunchTemplateName' => '<string>', 'Version' => '<string>', ], 'LoadBalancerNames' => ['<string>', ...], 'MaxInstanceLifetime' => <integer>, 'MaxSize' => <integer>, 'MinSize' => <integer>, 'MixedInstancesPolicy' => [ 'InstancesDistribution' => [ 'OnDemandAllocationStrategy' => '<string>', 'OnDemandBaseCapacity' => <integer>, 'OnDemandPercentageAboveBaseCapacity' => <integer>, 'SpotAllocationStrategy' => '<string>', 'SpotInstancePools' => <integer>, 'SpotMaxPrice' => '<string>', ], 'LaunchTemplate' => [ 'LaunchTemplateSpecification' => [ 'LaunchTemplateId' => '<string>', 'LaunchTemplateName' => '<string>', 'Version' => '<string>', ], 'Overrides' => [ [ 'InstanceType' => '<string>', 'WeightedCapacity' => '<string>', ], // ... ], ], ], 'NewInstancesProtectedFromScaleIn' => true || false, 'PlacementGroup' => '<string>', 'ServiceLinkedRoleARN' => '<string>', 'Status' => '<string>', 'SuspendedProcesses' => [ [ 'ProcessName' => '<string>', 'SuspensionReason' => '<string>', ], // ... ], 'Tags' => [ [ 'Key' => '<string>', 'PropagateAtLaunch' => true || false, 'ResourceId' => '<string>', 'ResourceType' => '<string>', 'Value' => '<string>', ], // ... ], 'TargetGroupARNs' => ['<string>', ...], 'TerminationPolicies' => ['<string>', ...], 'VPCZoneIdentifier' => '<string>', ], // ... ], 'NextToken' => '<string>', ]
Result Details
Members
- AutoScalingGroups
-
- Required: Yes
- Type: Array of AutoScalingGroup structures
The groups.
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
Errors
-
The
NextToken
value is not valid. -
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To describe an Auto Scaling group
This example describes the specified Auto Scaling group.
$result = $client->describeAutoScalingGroups([ 'AutoScalingGroupNames' => [ 'my-auto-scaling-group', ], ]);
Result syntax:
[ 'AutoScalingGroups' => [ [ 'AutoScalingGroupARN' => 'arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:930d940e-891e-4781-a11a-7b0acd480f03:autoScalingGroupName/my-auto-scaling-group', 'AutoScalingGroupName' => 'my-auto-scaling-group', 'AvailabilityZones' => [ 'us-west-2c', ], 'CreatedTime' =>, 'DefaultCooldown' => 300, 'DesiredCapacity' => 1, 'EnabledMetrics' => [ ], 'HealthCheckGracePeriod' => 300, 'HealthCheckType' => 'EC2', 'Instances' => [ [ 'AvailabilityZone' => 'us-west-2c', 'HealthStatus' => 'Healthy', 'InstanceId' => 'i-4ba0837f', 'LaunchConfigurationName' => 'my-launch-config', 'LifecycleState' => 'InService', 'ProtectedFromScaleIn' => , ], ], 'LaunchConfigurationName' => 'my-launch-config', 'LoadBalancerNames' => [ ], 'MaxSize' => 1, 'MinSize' => 0, 'NewInstancesProtectedFromScaleIn' => , 'SuspendedProcesses' => [ ], 'Tags' => [ ], 'TerminationPolicies' => [ 'Default', ], 'VPCZoneIdentifier' => 'subnet-12345678', ], ], ]
DescribeAutoScalingInstances
$result = $client->describeAutoScalingInstances
([/* ... */]); $promise = $client->describeAutoScalingInstancesAsync
([/* ... */]);
Describes one or more Auto Scaling instances.
Parameter Syntax
$result = $client->describeAutoScalingInstances([ 'InstanceIds' => ['<string>', ...], 'MaxRecords' => <integer>, 'NextToken' => '<string>', ]);
Parameter Details
Members
- InstanceIds
-
- Type: Array of strings
The IDs of the instances. You can specify up to
MaxRecords
IDs. If you omit this parameter, all Auto Scaling instances are described. If you specify an ID that does not exist, it is ignored with no error. - MaxRecords
-
- Type: int
The maximum number of items to return with this call. The default value is
50
and the maximum value is50
. - NextToken
-
- Type: string
The token for the next set of items to return. (You received this token from a previous call.)
Result Syntax
[ 'AutoScalingInstances' => [ [ 'AutoScalingGroupName' => '<string>', 'AvailabilityZone' => '<string>', 'HealthStatus' => '<string>', 'InstanceId' => '<string>', 'InstanceType' => '<string>', 'LaunchConfigurationName' => '<string>', 'LaunchTemplate' => [ 'LaunchTemplateId' => '<string>', 'LaunchTemplateName' => '<string>', 'Version' => '<string>', ], 'LifecycleState' => '<string>', 'ProtectedFromScaleIn' => true || false, 'WeightedCapacity' => '<string>', ], // ... ], 'NextToken' => '<string>', ]
Result Details
Members
- AutoScalingInstances
-
- Type: Array of AutoScalingInstanceDetails structures
The instances.
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
Errors
-
The
NextToken
value is not valid. -
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To describe one or more Auto Scaling instances
This example describes the specified Auto Scaling instance.
$result = $client->describeAutoScalingInstances([ 'InstanceIds' => [ 'i-4ba0837f', ], ]);
Result syntax:
[ 'AutoScalingInstances' => [ [ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'AvailabilityZone' => 'us-west-2c', 'HealthStatus' => 'HEALTHY', 'InstanceId' => 'i-4ba0837f', 'LaunchConfigurationName' => 'my-launch-config', 'LifecycleState' => 'InService', 'ProtectedFromScaleIn' => , ], ], ]
DescribeAutoScalingNotificationTypes
$result = $client->describeAutoScalingNotificationTypes
([/* ... */]); $promise = $client->describeAutoScalingNotificationTypesAsync
([/* ... */]);
Describes the notification types that are supported by Amazon EC2 Auto Scaling.
Parameter Syntax
$result = $client->describeAutoScalingNotificationTypes([ ]);
Parameter Details
Members
Result Syntax
[ 'AutoScalingNotificationTypes' => ['<string>', ...], ]
Result Details
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To describe the Auto Scaling notification types
This example describes the available notification types.
$result = $client->describeAutoScalingNotificationTypes([ ]);
Result syntax:
[ 'AutoScalingNotificationTypes' => [ 'autoscaling:EC2_INSTANCE_LAUNCH', 'autoscaling:EC2_INSTANCE_LAUNCH_ERROR', 'autoscaling:EC2_INSTANCE_TERMINATE', 'autoscaling:EC2_INSTANCE_TERMINATE_ERROR', 'autoscaling:TEST_NOTIFICATION', ], ]
DescribeLaunchConfigurations
$result = $client->describeLaunchConfigurations
([/* ... */]); $promise = $client->describeLaunchConfigurationsAsync
([/* ... */]);
Describes one or more launch configurations.
Parameter Syntax
$result = $client->describeLaunchConfigurations([ 'LaunchConfigurationNames' => ['<string>', ...], 'MaxRecords' => <integer>, 'NextToken' => '<string>', ]);
Parameter Details
Members
- LaunchConfigurationNames
-
- Type: Array of strings
The launch configuration names. If you omit this parameter, all launch configurations are described.
- MaxRecords
-
- Type: int
The maximum number of items to return with this call. The default value is
50
and the maximum value is100
. - NextToken
-
- Type: string
The token for the next set of items to return. (You received this token from a previous call.)
Result Syntax
[ 'LaunchConfigurations' => [ [ 'AssociatePublicIpAddress' => true || false, 'BlockDeviceMappings' => [ [ 'DeviceName' => '<string>', 'Ebs' => [ 'DeleteOnTermination' => true || false, 'Encrypted' => true || false, 'Iops' => <integer>, 'SnapshotId' => '<string>', 'VolumeSize' => <integer>, 'VolumeType' => '<string>', ], 'NoDevice' => true || false, 'VirtualName' => '<string>', ], // ... ], 'ClassicLinkVPCId' => '<string>', 'ClassicLinkVPCSecurityGroups' => ['<string>', ...], 'CreatedTime' => <DateTime>, 'EbsOptimized' => true || false, 'IamInstanceProfile' => '<string>', 'ImageId' => '<string>', 'InstanceMonitoring' => [ 'Enabled' => true || false, ], 'InstanceType' => '<string>', 'KernelId' => '<string>', 'KeyName' => '<string>', 'LaunchConfigurationARN' => '<string>', 'LaunchConfigurationName' => '<string>', 'PlacementTenancy' => '<string>', 'RamdiskId' => '<string>', 'SecurityGroups' => ['<string>', ...], 'SpotPrice' => '<string>', 'UserData' => '<string>', ], // ... ], 'NextToken' => '<string>', ]
Result Details
Members
- LaunchConfigurations
-
- Required: Yes
- Type: Array of LaunchConfiguration structures
The launch configurations.
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
Errors
-
The
NextToken
value is not valid. -
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To describe Auto Scaling launch configurations
This example describes the specified launch configuration.
$result = $client->describeLaunchConfigurations([ 'LaunchConfigurationNames' => [ 'my-launch-config', ], ]);
Result syntax:
[ 'LaunchConfigurations' => [ [ 'AssociatePublicIpAddress' => 1, 'BlockDeviceMappings' => [ ], 'CreatedTime' =>, 'EbsOptimized' => , 'ImageId' => 'ami-043a5034', 'InstanceMonitoring' => [ 'Enabled' => 1, ], 'InstanceType' => 't1.micro', 'LaunchConfigurationARN' => 'arn:aws:autoscaling:us-west-2:123456789012:launchConfiguration:98d3b196-4cf9-4e88-8ca1-8547c24ced8b:launchConfigurationName/my-launch-config', 'LaunchConfigurationName' => 'my-launch-config', 'SecurityGroups' => [ 'sg-67ef0308', ], ], ], ]
DescribeLifecycleHookTypes
$result = $client->describeLifecycleHookTypes
([/* ... */]); $promise = $client->describeLifecycleHookTypesAsync
([/* ... */]);
Describes the available types of lifecycle hooks.
The following hook types are supported:
-
autoscaling:EC2_INSTANCE_LAUNCHING
-
autoscaling:EC2_INSTANCE_TERMINATING
Parameter Syntax
$result = $client->describeLifecycleHookTypes([ ]);
Parameter Details
Members
Result Syntax
[ 'LifecycleHookTypes' => ['<string>', ...], ]
Result Details
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To describe the available types of lifecycle hooks
This example describes the available lifecycle hook types.
$result = $client->describeLifecycleHookTypes([ ]);
Result syntax:
[ 'LifecycleHookTypes' => [ 'autoscaling:EC2_INSTANCE_LAUNCHING', 'autoscaling:EC2_INSTANCE_TERMINATING', ], ]
DescribeLifecycleHooks
$result = $client->describeLifecycleHooks
([/* ... */]); $promise = $client->describeLifecycleHooksAsync
([/* ... */]);
Describes the lifecycle hooks for the specified Auto Scaling group.
Parameter Syntax
$result = $client->describeLifecycleHooks([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'LifecycleHookNames' => ['<string>', ...], ]);
Parameter Details
Members
Result Syntax
[ 'LifecycleHooks' => [ [ 'AutoScalingGroupName' => '<string>', 'DefaultResult' => '<string>', 'GlobalTimeout' => <integer>, 'HeartbeatTimeout' => <integer>, 'LifecycleHookName' => '<string>', 'LifecycleTransition' => '<string>', 'NotificationMetadata' => '<string>', 'NotificationTargetARN' => '<string>', 'RoleARN' => '<string>', ], // ... ], ]
Result Details
Members
- LifecycleHooks
-
- Type: Array of LifecycleHook structures
The lifecycle hooks for the specified group.
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To describe your lifecycle hooks
This example describes the lifecycle hooks for the specified Auto Scaling group.
$result = $client->describeLifecycleHooks([ 'AutoScalingGroupName' => 'my-auto-scaling-group', ]);
Result syntax:
[ 'LifecycleHooks' => [ [ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'DefaultResult' => 'ABANDON', 'GlobalTimeout' => 172800, 'HeartbeatTimeout' => 3600, 'LifecycleHookName' => 'my-lifecycle-hook', 'LifecycleTransition' => 'autoscaling:EC2_INSTANCE_LAUNCHING', 'NotificationTargetARN' => 'arn:aws:sns:us-west-2:123456789012:my-sns-topic', 'RoleARN' => 'arn:aws:iam::123456789012:role/my-auto-scaling-role', ], ], ]
DescribeLoadBalancerTargetGroups
$result = $client->describeLoadBalancerTargetGroups
([/* ... */]); $promise = $client->describeLoadBalancerTargetGroupsAsync
([/* ... */]);
Describes the target groups for the specified Auto Scaling group.
Parameter Syntax
$result = $client->describeLoadBalancerTargetGroups([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'MaxRecords' => <integer>, 'NextToken' => '<string>', ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- MaxRecords
-
- Type: int
The maximum number of items to return with this call. The default value is
100
and the maximum value is100
. - NextToken
-
- Type: string
The token for the next set of items to return. (You received this token from a previous call.)
Result Syntax
[ 'LoadBalancerTargetGroups' => [ [ 'LoadBalancerTargetGroupARN' => '<string>', 'State' => '<string>', ], // ... ], 'NextToken' => '<string>', ]
Result Details
Members
- LoadBalancerTargetGroups
-
- Type: Array of LoadBalancerTargetGroupState structures
Information about the target groups.
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To describe the target groups for an Auto Scaling group
This example describes the target groups attached to the specified Auto Scaling group.
$result = $client->describeLoadBalancerTargetGroups([ 'AutoScalingGroupName' => 'my-auto-scaling-group', ]);
Result syntax:
[ 'LoadBalancerTargetGroups' => [ [ 'LoadBalancerTargetGroupARN' => 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067', 'State' => 'Added', ], ], ]
DescribeLoadBalancers
$result = $client->describeLoadBalancers
([/* ... */]); $promise = $client->describeLoadBalancersAsync
([/* ... */]);
Describes the load balancers for the specified Auto Scaling group.
This operation describes only Classic Load Balancers. If you have Application Load Balancers or Network Load Balancers, use DescribeLoadBalancerTargetGroups instead.
Parameter Syntax
$result = $client->describeLoadBalancers([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'MaxRecords' => <integer>, 'NextToken' => '<string>', ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- MaxRecords
-
- Type: int
The maximum number of items to return with this call. The default value is
100
and the maximum value is100
. - NextToken
-
- Type: string
The token for the next set of items to return. (You received this token from a previous call.)
Result Syntax
[ 'LoadBalancers' => [ [ 'LoadBalancerName' => '<string>', 'State' => '<string>', ], // ... ], 'NextToken' => '<string>', ]
Result Details
Members
- LoadBalancers
-
- Type: Array of LoadBalancerState structures
The load balancers.
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To describe the load balancers for an Auto Scaling group
This example describes the load balancers attached to the specified Auto Scaling group.
$result = $client->describeLoadBalancers([ 'AutoScalingGroupName' => 'my-auto-scaling-group', ]);
Result syntax:
[ 'LoadBalancers' => [ [ 'LoadBalancerName' => 'my-load-balancer', 'State' => 'Added', ], ], ]
DescribeMetricCollectionTypes
$result = $client->describeMetricCollectionTypes
([/* ... */]); $promise = $client->describeMetricCollectionTypesAsync
([/* ... */]);
Describes the available CloudWatch metrics for Amazon EC2 Auto Scaling.
The GroupStandbyInstances
metric is not returned by default. You must explicitly request this metric when calling EnableMetricsCollection.
Parameter Syntax
$result = $client->describeMetricCollectionTypes([ ]);
Parameter Details
Members
Result Syntax
[ 'Granularities' => [ [ 'Granularity' => '<string>', ], // ... ], 'Metrics' => [ [ 'Metric' => '<string>', ], // ... ], ]
Result Details
Members
- Granularities
-
- Type: Array of MetricGranularityType structures
The granularities for the metrics.
- Metrics
-
- Type: Array of MetricCollectionType structures
One or more metrics.
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To describe the Auto Scaling metric collection types
This example describes the available metric collection types.
$result = $client->describeMetricCollectionTypes([ ]);
Result syntax:
[ 'Granularities' => [ [ 'Granularity' => '1Minute', ], ], 'Metrics' => [ [ 'Metric' => 'GroupMinSize', ], [ 'Metric' => 'GroupMaxSize', ], [ 'Metric' => 'GroupDesiredCapacity', ], [ 'Metric' => 'GroupInServiceInstances', ], [ 'Metric' => 'GroupPendingInstances', ], [ 'Metric' => 'GroupTerminatingInstances', ], [ 'Metric' => 'GroupStandbyInstances', ], [ 'Metric' => 'GroupTotalInstances', ], ], ]
DescribeNotificationConfigurations
$result = $client->describeNotificationConfigurations
([/* ... */]); $promise = $client->describeNotificationConfigurationsAsync
([/* ... */]);
Describes the notification actions associated with the specified Auto Scaling group.
Parameter Syntax
$result = $client->describeNotificationConfigurations([ 'AutoScalingGroupNames' => ['<string>', ...], 'MaxRecords' => <integer>, 'NextToken' => '<string>', ]);
Parameter Details
Members
- AutoScalingGroupNames
-
- Type: Array of strings
The name of the Auto Scaling group.
- MaxRecords
-
- Type: int
The maximum number of items to return with this call. The default value is
50
and the maximum value is100
. - NextToken
-
- Type: string
The token for the next set of items to return. (You received this token from a previous call.)
Result Syntax
[ 'NextToken' => '<string>', 'NotificationConfigurations' => [ [ 'AutoScalingGroupName' => '<string>', 'NotificationType' => '<string>', 'TopicARN' => '<string>', ], // ... ], ]
Result Details
Members
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return. - NotificationConfigurations
-
- Required: Yes
- Type: Array of NotificationConfiguration structures
The notification configurations.
Errors
-
The
NextToken
value is not valid. -
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To describe Auto Scaling notification configurations
This example describes the notification configurations for the specified Auto Scaling group.
$result = $client->describeNotificationConfigurations([ 'AutoScalingGroupNames' => [ 'my-auto-scaling-group', ], ]);
Result syntax:
[ 'NotificationConfigurations' => [ [ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'NotificationType' => 'autoscaling:TEST_NOTIFICATION', 'TopicARN' => 'arn:aws:sns:us-west-2:123456789012:my-sns-topic-2', ], [ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'NotificationType' => 'autoscaling:TEST_NOTIFICATION', 'TopicARN' => 'arn:aws:sns:us-west-2:123456789012:my-sns-topic', ], ], ]
DescribePolicies
$result = $client->describePolicies
([/* ... */]); $promise = $client->describePoliciesAsync
([/* ... */]);
Describes the policies for the specified Auto Scaling group.
Parameter Syntax
$result = $client->describePolicies([ 'AutoScalingGroupName' => '<string>', 'MaxRecords' => <integer>, 'NextToken' => '<string>', 'PolicyNames' => ['<string>', ...], 'PolicyTypes' => ['<string>', ...], ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Type: string
The name of the Auto Scaling group.
- MaxRecords
-
- Type: int
The maximum number of items to be returned with each call. The default value is
50
and the maximum value is100
. - NextToken
-
- Type: string
The token for the next set of items to return. (You received this token from a previous call.)
- PolicyNames
-
- Type: Array of strings
The names of one or more policies. If you omit this parameter, all policies are described. If a group name is provided, the results are limited to that group. This list is limited to 50 items. If you specify an unknown policy name, it is ignored with no error.
- PolicyTypes
-
- Type: Array of strings
One or more policy types. The valid values are
SimpleScaling
,StepScaling
, andTargetTrackingScaling
.
Result Syntax
[ 'NextToken' => '<string>', 'ScalingPolicies' => [ [ 'AdjustmentType' => '<string>', 'Alarms' => [ [ 'AlarmARN' => '<string>', 'AlarmName' => '<string>', ], // ... ], 'AutoScalingGroupName' => '<string>', 'Cooldown' => <integer>, 'EstimatedInstanceWarmup' => <integer>, 'MetricAggregationType' => '<string>', 'MinAdjustmentMagnitude' => <integer>, 'MinAdjustmentStep' => <integer>, 'PolicyARN' => '<string>', 'PolicyName' => '<string>', 'PolicyType' => '<string>', 'ScalingAdjustment' => <integer>, 'StepAdjustments' => [ [ 'MetricIntervalLowerBound' => <float>, 'MetricIntervalUpperBound' => <float>, 'ScalingAdjustment' => <integer>, ], // ... ], 'TargetTrackingConfiguration' => [ 'CustomizedMetricSpecification' => [ 'Dimensions' => [ [ 'Name' => '<string>', 'Value' => '<string>', ], // ... ], 'MetricName' => '<string>', 'Namespace' => '<string>', 'Statistic' => 'Average|Minimum|Maximum|SampleCount|Sum', 'Unit' => '<string>', ], 'DisableScaleIn' => true || false, 'PredefinedMetricSpecification' => [ 'PredefinedMetricType' => 'ASGAverageCPUUtilization|ASGAverageNetworkIn|ASGAverageNetworkOut|ALBRequestCountPerTarget', 'ResourceLabel' => '<string>', ], 'TargetValue' => <float>, ], ], // ... ], ]
Result Details
Members
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return. - ScalingPolicies
-
- Type: Array of ScalingPolicy structures
The scaling policies.
Errors
-
The
NextToken
value is not valid. -
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
-
The service-linked role is not yet ready for use.
Examples
Example 1: To describe Auto Scaling policies
This example describes the policies for the specified Auto Scaling group.
$result = $client->describePolicies([ 'AutoScalingGroupName' => 'my-auto-scaling-group', ]);
Result syntax:
[ 'ScalingPolicies' => [ [ 'AdjustmentType' => 'ChangeInCapacity', 'Alarms' => [ ], 'AutoScalingGroupName' => 'my-auto-scaling-group', 'PolicyARN' => 'arn:aws:autoscaling:us-west-2:123456789012:scalingPolicy:2233f3d7-6290-403b-b632-93c553560106:autoScalingGroupName/my-auto-scaling-group:policyName/ScaleIn', 'PolicyName' => 'ScaleIn', 'ScalingAdjustment' => -1, ], [ 'AdjustmentType' => 'PercentChangeInCapacity', 'Alarms' => [ ], 'AutoScalingGroupName' => 'my-auto-scaling-group', 'Cooldown' => 60, 'MinAdjustmentStep' => 2, 'PolicyARN' => 'arn:aws:autoscaling:us-west-2:123456789012:scalingPolicy:2b435159-cf77-4e89-8c0e-d63b497baad7:autoScalingGroupName/my-auto-scaling-group:policyName/ScalePercentChange', 'PolicyName' => 'ScalePercentChange', 'ScalingAdjustment' => 25, ], ], ]
DescribeScalingActivities
$result = $client->describeScalingActivities
([/* ... */]); $promise = $client->describeScalingActivitiesAsync
([/* ... */]);
Describes one or more scaling activities for the specified Auto Scaling group.
Parameter Syntax
$result = $client->describeScalingActivities([ 'ActivityIds' => ['<string>', ...], 'AutoScalingGroupName' => '<string>', 'MaxRecords' => <integer>, 'NextToken' => '<string>', ]);
Parameter Details
Members
- ActivityIds
-
- Type: Array of strings
The activity IDs of the desired scaling activities. You can specify up to 50 IDs. If you omit this parameter, all activities for the past six weeks are described. If unknown activities are requested, they are ignored with no error. If you specify an Auto Scaling group, the results are limited to that group.
- AutoScalingGroupName
-
- Type: string
The name of the Auto Scaling group.
- MaxRecords
-
- Type: int
The maximum number of items to return with this call. The default value is
100
and the maximum value is100
. - NextToken
-
- Type: string
The token for the next set of items to return. (You received this token from a previous call.)
Result Syntax
[ 'Activities' => [ [ 'ActivityId' => '<string>', 'AutoScalingGroupName' => '<string>', 'Cause' => '<string>', 'Description' => '<string>', 'Details' => '<string>', 'EndTime' => <DateTime>, 'Progress' => <integer>, 'StartTime' => <DateTime>, 'StatusCode' => 'PendingSpotBidPlacement|WaitingForSpotInstanceRequestId|WaitingForSpotInstanceId|WaitingForInstanceId|PreInService|InProgress|WaitingForELBConnectionDraining|MidLifecycleAction|WaitingForInstanceWarmup|Successful|Failed|Cancelled', 'StatusMessage' => '<string>', ], // ... ], 'NextToken' => '<string>', ]
Result Details
Members
- Activities
-
- Required: Yes
- Type: Array of Activity structures
The scaling activities. Activities are sorted by start time. Activities still in progress are described first.
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
Errors
-
The
NextToken
value is not valid. -
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To describe the scaling activities for an Auto Scaling group
This example describes the scaling activities for the specified Auto Scaling group.
$result = $client->describeScalingActivities([ 'AutoScalingGroupName' => 'my-auto-scaling-group', ]);
Result syntax:
[ 'Activities' => [ [ 'ActivityId' => 'f9f2d65b-f1f2-43e7-b46d-d86756459699', 'AutoScalingGroupName' => 'my-auto-scaling-group', 'Cause' => 'At 2013-08-19T20:53:25Z a user request created an AutoScalingGroup changing the desired capacity from 0 to 1. At 2013-08-19T20:53:29Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 1.', 'Description' => 'Launching a new EC2 instance: i-4ba0837f', 'Details' => 'details', 'EndTime' =>, 'Progress' => 100, 'StartTime' => , 'StatusCode' => 'Successful', ], ], ]
DescribeScalingProcessTypes
$result = $client->describeScalingProcessTypes
([/* ... */]); $promise = $client->describeScalingProcessTypesAsync
([/* ... */]);
Describes the scaling process types for use with ResumeProcesses and SuspendProcesses.
Parameter Syntax
$result = $client->describeScalingProcessTypes([ ]);
Parameter Details
Members
Result Syntax
[ 'Processes' => [ [ 'ProcessName' => '<string>', ], // ... ], ]
Result Details
Members
- Processes
-
- Type: Array of ProcessType structures
The names of the process types.
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To describe the Auto Scaling process types
This example describes the Auto Scaling process types.
$result = $client->describeScalingProcessTypes([ ]);
Result syntax:
[ 'Processes' => [ [ 'ProcessName' => 'AZRebalance', ], [ 'ProcessName' => 'AddToLoadBalancer', ], [ 'ProcessName' => 'AlarmNotification', ], [ 'ProcessName' => 'HealthCheck', ], [ 'ProcessName' => 'Launch', ], [ 'ProcessName' => 'ReplaceUnhealthy', ], [ 'ProcessName' => 'ScheduledActions', ], [ 'ProcessName' => 'Terminate', ], ], ]
DescribeScheduledActions
$result = $client->describeScheduledActions
([/* ... */]); $promise = $client->describeScheduledActionsAsync
([/* ... */]);
Describes the actions scheduled for your Auto Scaling group that haven't run or that have not reached their end time. To describe the actions that have already run, use DescribeScalingActivities.
Parameter Syntax
$result = $client->describeScheduledActions([ 'AutoScalingGroupName' => '<string>', 'EndTime' => <integer || string || DateTime>, 'MaxRecords' => <integer>, 'NextToken' => '<string>', 'ScheduledActionNames' => ['<string>', ...], 'StartTime' => <integer || string || DateTime>, ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Type: string
The name of the Auto Scaling group.
- EndTime
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The latest scheduled start time to return. If scheduled action names are provided, this parameter is ignored.
- MaxRecords
-
- Type: int
The maximum number of items to return with this call. The default value is
50
and the maximum value is100
. - NextToken
-
- Type: string
The token for the next set of items to return. (You received this token from a previous call.)
- ScheduledActionNames
-
- Type: Array of strings
The names of one or more scheduled actions. You can specify up to 50 actions. If you omit this parameter, all scheduled actions are described. If you specify an unknown scheduled action, it is ignored with no error.
- StartTime
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The earliest scheduled start time to return. If scheduled action names are provided, this parameter is ignored.
Result Syntax
[ 'NextToken' => '<string>', 'ScheduledUpdateGroupActions' => [ [ 'AutoScalingGroupName' => '<string>', 'DesiredCapacity' => <integer>, 'EndTime' => <DateTime>, 'MaxSize' => <integer>, 'MinSize' => <integer>, 'Recurrence' => '<string>', 'ScheduledActionARN' => '<string>', 'ScheduledActionName' => '<string>', 'StartTime' => <DateTime>, 'Time' => <DateTime>, ], // ... ], ]
Result Details
Members
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return. - ScheduledUpdateGroupActions
-
- Type: Array of ScheduledUpdateGroupAction structures
The scheduled actions.
Errors
-
The
NextToken
value is not valid. -
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To describe scheduled actions
This example describes the scheduled actions for the specified Auto Scaling group.
$result = $client->describeScheduledActions([ 'AutoScalingGroupName' => 'my-auto-scaling-group', ]);
Result syntax:
[ 'ScheduledUpdateGroupActions' => [ [ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'DesiredCapacity' => 4, 'MaxSize' => 6, 'MinSize' => 2, 'Recurrence' => '30 0 1 12 0', 'ScheduledActionARN' => 'arn:aws:autoscaling:us-west-2:123456789012:scheduledUpdateGroupAction:8e86b655-b2e6-4410-8f29-b4f094d6871c:autoScalingGroupName/my-auto-scaling-group:scheduledActionName/my-scheduled-action', 'ScheduledActionName' => 'my-scheduled-action', 'StartTime' =>, 'Time' => , ], ], ]
DescribeTags
$result = $client->describeTags
([/* ... */]); $promise = $client->describeTagsAsync
([/* ... */]);
Describes the specified tags.
You can use filters to limit the results. For example, you can query for the tags for a specific Auto Scaling group. You can specify multiple values for a filter. A tag must match at least one of the specified values for it to be included in the results.
You can also specify multiple filters. The result includes information for a particular tag only if it matches all the filters. If there's no match, no special message is returned.
Parameter Syntax
$result = $client->describeTags([ 'Filters' => [ [ 'Name' => '<string>', 'Values' => ['<string>', ...], ], // ... ], 'MaxRecords' => <integer>, 'NextToken' => '<string>', ]);
Parameter Details
Members
- Filters
-
- Type: Array of Filter structures
One or more filters to scope the tags to return. The maximum number of filters per filter type (for example,
auto-scaling-group
) is 1000. - MaxRecords
-
- Type: int
The maximum number of items to return with this call. The default value is
50
and the maximum value is100
. - NextToken
-
- Type: string
The token for the next set of items to return. (You received this token from a previous call.)
Result Syntax
[ 'NextToken' => '<string>', 'Tags' => [ [ 'Key' => '<string>', 'PropagateAtLaunch' => true || false, 'ResourceId' => '<string>', 'ResourceType' => '<string>', 'Value' => '<string>', ], // ... ], ]
Result Details
Members
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return. - Tags
-
- Type: Array of TagDescription structures
One or more tags.
Errors
-
The
NextToken
value is not valid. -
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To describe tags
This example describes the tags for the specified Auto Scaling group.
$result = $client->describeTags([ 'Filters' => [ [ 'Name' => 'auto-scaling-group', 'Values' => [ 'my-auto-scaling-group', ], ], ], ]);
Result syntax:
[ 'Tags' => [ [ 'Key' => 'Dept', 'PropagateAtLaunch' => 1, 'ResourceId' => 'my-auto-scaling-group', 'ResourceType' => 'auto-scaling-group', 'Value' => 'Research', ], [ 'Key' => 'Role', 'PropagateAtLaunch' => 1, 'ResourceId' => 'my-auto-scaling-group', 'ResourceType' => 'auto-scaling-group', 'Value' => 'WebServer', ], ], ]
DescribeTerminationPolicyTypes
$result = $client->describeTerminationPolicyTypes
([/* ... */]); $promise = $client->describeTerminationPolicyTypesAsync
([/* ... */]);
Describes the termination policies supported by Amazon EC2 Auto Scaling.
For more information, see Controlling Which Auto Scaling Instances Terminate During Scale In in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->describeTerminationPolicyTypes([ ]);
Parameter Details
Members
Result Syntax
[ 'TerminationPolicyTypes' => ['<string>', ...], ]
Result Details
Members
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To describe termination policy types
This example describes the available termination policy types.
$result = $client->describeTerminationPolicyTypes([ ]);
Result syntax:
[ 'TerminationPolicyTypes' => [ 'ClosestToNextInstanceHour', 'Default', 'NewestInstance', 'OldestInstance', 'OldestLaunchConfiguration', ], ]
DetachInstances
$result = $client->detachInstances
([/* ... */]); $promise = $client->detachInstancesAsync
([/* ... */]);
Removes one or more instances from the specified Auto Scaling group.
After the instances are detached, you can manage them independent of the Auto Scaling group.
If you do not specify the option to decrement the desired capacity, Amazon EC2 Auto Scaling launches instances to replace the ones that are detached.
If there is a Classic Load Balancer attached to the Auto Scaling group, the instances are deregistered from the load balancer. If there are target groups attached to the Auto Scaling group, the instances are deregistered from the target groups.
For more information, see Detach EC2 Instances from Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->detachInstances([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'InstanceIds' => ['<string>', ...], 'ShouldDecrementDesiredCapacity' => true || false, // REQUIRED ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- InstanceIds
-
- Type: Array of strings
The IDs of the instances. You can specify up to 20 instances.
- ShouldDecrementDesiredCapacity
-
- Required: Yes
- Type: boolean
Indicates whether the Auto Scaling group decrements the desired capacity value by the number of instances detached.
Result Syntax
[ 'Activities' => [ [ 'ActivityId' => '<string>', 'AutoScalingGroupName' => '<string>', 'Cause' => '<string>', 'Description' => '<string>', 'Details' => '<string>', 'EndTime' => <DateTime>, 'Progress' => <integer>, 'StartTime' => <DateTime>, 'StatusCode' => 'PendingSpotBidPlacement|WaitingForSpotInstanceRequestId|WaitingForSpotInstanceId|WaitingForInstanceId|PreInService|InProgress|WaitingForELBConnectionDraining|MidLifecycleAction|WaitingForInstanceWarmup|Successful|Failed|Cancelled', 'StatusMessage' => '<string>', ], // ... ], ]
Result Details
Members
- Activities
-
- Type: Array of Activity structures
The activities related to detaching the instances from the Auto Scaling group.
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To detach an instance from an Auto Scaling group
This example detaches the specified instance from the specified Auto Scaling group.
$result = $client->detachInstances([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'InstanceIds' => [ 'i-93633f9b', ], 'ShouldDecrementDesiredCapacity' => 1, ]);
Result syntax:
[ 'Activities' => [ [ 'ActivityId' => '5091cb52-547a-47ce-a236-c9ccbc2cb2c9', 'AutoScalingGroupName' => 'my-auto-scaling-group', 'Cause' => 'At 2015-04-12T15:02:16Z instance i-93633f9b was detached in response to a user request, shrinking the capacity from 2 to 1.', 'Description' => 'Detaching EC2 instance: i-93633f9b', 'Details' => 'details', 'Progress' => 50, 'StartTime' =>, 'StatusCode' => 'InProgress', ], ], ]
DetachLoadBalancerTargetGroups
$result = $client->detachLoadBalancerTargetGroups
([/* ... */]); $promise = $client->detachLoadBalancerTargetGroupsAsync
([/* ... */]);
Detaches one or more target groups from the specified Auto Scaling group.
Parameter Syntax
$result = $client->detachLoadBalancerTargetGroups([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'TargetGroupARNs' => ['<string>', ...], // REQUIRED ]);
Parameter Details
Members
Result Syntax
[]
Result Details
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To detach a target group from an Auto Scaling group
This example detaches the specified target group from the specified Auto Scaling group
$result = $client->detachLoadBalancerTargetGroups([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'TargetGroupARNs' => [ 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067', ], ]);
DetachLoadBalancers
$result = $client->detachLoadBalancers
([/* ... */]); $promise = $client->detachLoadBalancersAsync
([/* ... */]);
Detaches one or more Classic Load Balancers from the specified Auto Scaling group.
This operation detaches only Classic Load Balancers. If you have Application Load Balancers or Network Load Balancers, use DetachLoadBalancerTargetGroups instead.
When you detach a load balancer, it enters the Removing
state while deregistering the instances in the group. When all instances are deregistered, then you can no longer describe the load balancer using DescribeLoadBalancers. The instances remain running.
Parameter Syntax
$result = $client->detachLoadBalancers([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'LoadBalancerNames' => ['<string>', ...], // REQUIRED ]);
Parameter Details
Members
Result Syntax
[]
Result Details
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To detach a load balancer from an Auto Scaling group
This example detaches the specified load balancer from the specified Auto Scaling group.
$result = $client->detachLoadBalancers([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'LoadBalancerNames' => [ 'my-load-balancer', ], ]);
DisableMetricsCollection
$result = $client->disableMetricsCollection
([/* ... */]); $promise = $client->disableMetricsCollectionAsync
([/* ... */]);
Disables group metrics for the specified Auto Scaling group.
Parameter Syntax
$result = $client->disableMetricsCollection([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'Metrics' => ['<string>', ...], ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- Metrics
-
- Type: Array of strings
One or more of the following metrics. If you omit this parameter, all metrics are disabled.
-
GroupMinSize
-
GroupMaxSize
-
GroupDesiredCapacity
-
GroupInServiceInstances
-
GroupPendingInstances
-
GroupStandbyInstances
-
GroupTerminatingInstances
-
GroupTotalInstances
Result Syntax
[]
Result Details
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To disable metrics collection for an Auto Scaling group
This example disables collecting data for the GroupDesiredCapacity metric for the specified Auto Scaling group.
$result = $client->disableMetricsCollection([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'Metrics' => [ 'GroupDesiredCapacity', ], ]);
EnableMetricsCollection
$result = $client->enableMetricsCollection
([/* ... */]); $promise = $client->enableMetricsCollectionAsync
([/* ... */]);
Enables group metrics for the specified Auto Scaling group. For more information, see Monitoring Your Auto Scaling Groups and Instances in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->enableMetricsCollection([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'Granularity' => '<string>', // REQUIRED 'Metrics' => ['<string>', ...], ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- Granularity
-
- Required: Yes
- Type: string
The granularity to associate with the metrics to collect. The only valid value is
1Minute
. - Metrics
-
- Type: Array of strings
One or more of the following metrics. If you omit this parameter, all metrics are enabled.
-
GroupMinSize
-
GroupMaxSize
-
GroupDesiredCapacity
-
GroupInServiceInstances
-
GroupPendingInstances
-
GroupStandbyInstances
-
GroupTerminatingInstances
-
GroupTotalInstances
Result Syntax
[]
Result Details
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To enable metrics collection for an Auto Scaling group
This example enables data collection for the specified Auto Scaling group.
$result = $client->enableMetricsCollection([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'Granularity' => '1Minute', ]);
EnterStandby
$result = $client->enterStandby
([/* ... */]); $promise = $client->enterStandbyAsync
([/* ... */]);
Moves the specified instances into the standby state.
If you choose to decrement the desired capacity of the Auto Scaling group, the instances can enter standby as long as the desired capacity of the Auto Scaling group after the instances are placed into standby is equal to or greater than the minimum capacity of the group.
If you choose not to decrement the desired capacity of the Auto Scaling group, the Auto Scaling group launches new instances to replace the instances on standby.
For more information, see Temporarily Removing Instances from Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->enterStandby([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'InstanceIds' => ['<string>', ...], 'ShouldDecrementDesiredCapacity' => true || false, // REQUIRED ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- InstanceIds
-
- Type: Array of strings
The IDs of the instances. You can specify up to 20 instances.
- ShouldDecrementDesiredCapacity
-
- Required: Yes
- Type: boolean
Indicates whether to decrement the desired capacity of the Auto Scaling group by the number of instances moved to
Standby
mode.
Result Syntax
[ 'Activities' => [ [ 'ActivityId' => '<string>', 'AutoScalingGroupName' => '<string>', 'Cause' => '<string>', 'Description' => '<string>', 'Details' => '<string>', 'EndTime' => <DateTime>, 'Progress' => <integer>, 'StartTime' => <DateTime>, 'StatusCode' => 'PendingSpotBidPlacement|WaitingForSpotInstanceRequestId|WaitingForSpotInstanceId|WaitingForInstanceId|PreInService|InProgress|WaitingForELBConnectionDraining|MidLifecycleAction|WaitingForInstanceWarmup|Successful|Failed|Cancelled', 'StatusMessage' => '<string>', ], // ... ], ]
Result Details
Members
- Activities
-
- Type: Array of Activity structures
The activities related to moving instances into
Standby
mode.
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To move instances into standby mode
This example puts the specified instance into standby mode.
$result = $client->enterStandby([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'InstanceIds' => [ 'i-93633f9b', ], 'ShouldDecrementDesiredCapacity' => 1, ]);
Result syntax:
[ 'Activities' => [ [ 'ActivityId' => 'ffa056b4-6ed3-41ba-ae7c-249dfae6eba1', 'AutoScalingGroupName' => 'my-auto-scaling-group', 'Cause' => 'At 2015-04-12T15:10:23Z instance i-93633f9b was moved to standby in response to a user request, shrinking the capacity from 2 to 1.', 'Description' => 'Moving EC2 instance to Standby: i-93633f9b', 'Details' => 'details', 'Progress' => 50, 'StartTime' =>, 'StatusCode' => 'InProgress', ], ], ]
ExecutePolicy
$result = $client->executePolicy
([/* ... */]); $promise = $client->executePolicyAsync
([/* ... */]);
Executes the specified policy.
Parameter Syntax
$result = $client->executePolicy([ 'AutoScalingGroupName' => '<string>', 'BreachThreshold' => <float>, 'HonorCooldown' => true || false, 'MetricValue' => <float>, 'PolicyName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Type: string
The name of the Auto Scaling group.
- BreachThreshold
-
- Type: double
The breach threshold for the alarm.
Conditional: This parameter is required if the policy type is
StepScaling
and not supported otherwise. - HonorCooldown
-
- Type: boolean
Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before executing the policy.
This parameter is not supported if the policy type is
StepScaling
orTargetTrackingScaling
.For more information, see Scaling Cooldowns in the Amazon EC2 Auto Scaling User Guide.
- MetricValue
-
- Type: double
The metric value to compare to
BreachThreshold
. This enables you to execute a policy of typeStepScaling
and determine which step adjustment to use. For example, if the breach threshold is 50 and you want to use a step adjustment with a lower bound of 0 and an upper bound of 10, you can set the metric value to 59.If you specify a metric value that doesn't correspond to a step adjustment for the policy, the call returns an error.
Conditional: This parameter is required if the policy type is
StepScaling
and not supported otherwise. - PolicyName
-
- Required: Yes
- Type: string
The name or ARN of the policy.
Result Syntax
[]
Result Details
Errors
-
ScalingActivityInProgressFault:
The operation can't be performed because there are scaling activities in progress.
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To execute an Auto Scaling policy
This example executes the specified Auto Scaling policy for the specified Auto Scaling group.
$result = $client->executePolicy([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'HonorCooldown' => 1, 'PolicyName' => 'ScaleIn', ]);
ExitStandby
$result = $client->exitStandby
([/* ... */]); $promise = $client->exitStandbyAsync
([/* ... */]);
Moves the specified instances out of the standby state.
After you put the instances back in service, the desired capacity is incremented.
For more information, see Temporarily Removing Instances from Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->exitStandby([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'InstanceIds' => ['<string>', ...], ]);
Parameter Details
Members
Result Syntax
[ 'Activities' => [ [ 'ActivityId' => '<string>', 'AutoScalingGroupName' => '<string>', 'Cause' => '<string>', 'Description' => '<string>', 'Details' => '<string>', 'EndTime' => <DateTime>, 'Progress' => <integer>, 'StartTime' => <DateTime>, 'StatusCode' => 'PendingSpotBidPlacement|WaitingForSpotInstanceRequestId|WaitingForSpotInstanceId|WaitingForInstanceId|PreInService|InProgress|WaitingForELBConnectionDraining|MidLifecycleAction|WaitingForInstanceWarmup|Successful|Failed|Cancelled', 'StatusMessage' => '<string>', ], // ... ], ]
Result Details
Members
- Activities
-
- Type: Array of Activity structures
The activities related to moving instances out of
Standby
mode.
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To move instances out of standby mode
This example moves the specified instance out of standby mode.
$result = $client->exitStandby([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'InstanceIds' => [ 'i-93633f9b', ], ]);
Result syntax:
[ 'Activities' => [ [ 'ActivityId' => '142928e1-a2dc-453a-9b24-b85ad6735928', 'AutoScalingGroupName' => 'my-auto-scaling-group', 'Cause' => 'At 2015-04-12T15:14:29Z instance i-93633f9b was moved out of standby in response to a user request, increasing the capacity from 1 to 2.', 'Description' => 'Moving EC2 instance out of Standby: i-93633f9b', 'Details' => 'details', 'Progress' => 30, 'StartTime' =>, 'StatusCode' => 'PreInService', ], ], ]
PutLifecycleHook
$result = $client->putLifecycleHook
([/* ... */]); $promise = $client->putLifecycleHookAsync
([/* ... */]);
Creates or updates a lifecycle hook for the specified Auto Scaling group.
A lifecycle hook tells Amazon EC2 Auto Scaling to perform an action on an instance when the instance launches (before it is put into service) or as the instance terminates (before it is fully terminated).
This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:
-
(Optional) Create a Lambda function and a rule that allows CloudWatch Events to invoke your Lambda function when Amazon EC2 Auto Scaling launches or terminates instances.
-
(Optional) Create a notification target and an IAM role. The target can be either an Amazon SQS queue or an Amazon SNS topic. The role allows Amazon EC2 Auto Scaling to publish lifecycle notifications to the target.
-
Create the lifecycle hook. Specify whether the hook is used when the instances launch or terminate.
-
If you need more time, record the lifecycle action heartbeat to keep the instance in a pending state using RecordLifecycleActionHeartbeat.
-
If you finish before the timeout period ends, complete the lifecycle action using CompleteLifecycleAction.
For more information, see Amazon EC2 Auto Scaling Lifecycle Hooks in the Amazon EC2 Auto Scaling User Guide.
If you exceed your maximum limit of lifecycle hooks, which by default is 50 per Auto Scaling group, the call fails.
You can view the lifecycle hooks for an Auto Scaling group using DescribeLifecycleHooks. If you are no longer using a lifecycle hook, you can delete it using DeleteLifecycleHook.
Parameter Syntax
$result = $client->putLifecycleHook([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'DefaultResult' => '<string>', 'HeartbeatTimeout' => <integer>, 'LifecycleHookName' => '<string>', // REQUIRED 'LifecycleTransition' => '<string>', 'NotificationMetadata' => '<string>', 'NotificationTargetARN' => '<string>', 'RoleARN' => '<string>', ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- DefaultResult
-
- Type: string
Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. This parameter can be either
CONTINUE
orABANDON
. The default value isABANDON
. - HeartbeatTimeout
-
- Type: int
The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from
30
to7200
seconds. The default value is3600
seconds (1 hour).If the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the
DefaultResult
parameter. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat. - LifecycleHookName
-
- Required: Yes
- Type: string
The name of the lifecycle hook.
- LifecycleTransition
-
- Type: string
The instance state to which you want to attach the lifecycle hook. The valid values are:
-
autoscaling:EC2_INSTANCE_LAUNCHING
-
autoscaling:EC2_INSTANCE_TERMINATING
Conditional: This parameter is required for new lifecycle hooks, but optional when updating existing hooks.
- NotificationMetadata
-
- Type: string
Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.
- NotificationTargetARN
-
- Type: string
The ARN of the notification target that Amazon EC2 Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. This target can be either an SQS queue or an SNS topic.
If you specify an empty string, this overrides the current ARN.
This operation uses the JSON format when sending notifications to an Amazon SQS queue, and an email key-value pair format when sending notifications to an Amazon SNS topic.
When you specify a notification target, Amazon EC2 Auto Scaling sends it a test message. Test messages contain the following additional key-value pair:
"Event": "autoscaling:TEST_NOTIFICATION"
. - RoleARN
-
- Type: string
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target, for example, an Amazon SNS topic or an Amazon SQS queue.
Conditional: This parameter is required for new lifecycle hooks, but optional when updating existing hooks.
Result Syntax
[]
Result Details
Errors
-
You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits.
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To create a lifecycle hook
This example creates a lifecycle hook.
$result = $client->putLifecycleHook([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'LifecycleHookName' => 'my-lifecycle-hook', 'LifecycleTransition' => 'autoscaling:EC2_INSTANCE_LAUNCHING', 'NotificationTargetARN' => 'arn:aws:sns:us-west-2:123456789012:my-sns-topic --role-arn', 'RoleARN' => 'arn:aws:iam::123456789012:role/my-auto-scaling-role', ]);
PutNotificationConfiguration
$result = $client->putNotificationConfiguration
([/* ... */]); $promise = $client->putNotificationConfigurationAsync
([/* ... */]);
Configures an Auto Scaling group to send notifications when specified events take place. Subscribers to the specified topic can have messages delivered to an endpoint such as a web server or an email address.
This configuration overwrites any existing configuration.
For more information, see Getting Amazon SNS Notifications When Your Auto Scaling Group Scales in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->putNotificationConfiguration([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'NotificationTypes' => ['<string>', ...], // REQUIRED 'TopicARN' => '<string>', // REQUIRED ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- NotificationTypes
-
- Required: Yes
- Type: Array of strings
The type of event that causes the notification to be sent. For more information about notification types supported by Amazon EC2 Auto Scaling, see DescribeAutoScalingNotificationTypes.
- TopicARN
-
- Required: Yes
- Type: string
The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (Amazon SNS) topic.
Result Syntax
[]
Result Details
Errors
-
You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits.
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
-
The service-linked role is not yet ready for use.
Examples
Example 1: To add an Auto Scaling notification
This example adds the specified notification to the specified Auto Scaling group.
$result = $client->putNotificationConfiguration([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'NotificationTypes' => [ 'autoscaling:TEST_NOTIFICATION', ], 'TopicARN' => 'arn:aws:sns:us-west-2:123456789012:my-sns-topic', ]);
PutScalingPolicy
$result = $client->putScalingPolicy
([/* ... */]); $promise = $client->putScalingPolicyAsync
([/* ... */]);
Creates or updates a scaling policy for an Auto Scaling group. To update an existing scaling policy, use the existing policy name and set the parameters to change. Any existing parameter not changed in an update to an existing policy is not changed in this update request.
For more information about using scaling policies to scale your Auto Scaling group automatically, see Dynamic Scaling in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->putScalingPolicy([ 'AdjustmentType' => '<string>', 'AutoScalingGroupName' => '<string>', // REQUIRED 'Cooldown' => <integer>, 'EstimatedInstanceWarmup' => <integer>, 'MetricAggregationType' => '<string>', 'MinAdjustmentMagnitude' => <integer>, 'MinAdjustmentStep' => <integer>, 'PolicyName' => '<string>', // REQUIRED 'PolicyType' => '<string>', 'ScalingAdjustment' => <integer>, 'StepAdjustments' => [ [ 'MetricIntervalLowerBound' => <float>, 'MetricIntervalUpperBound' => <float>, 'ScalingAdjustment' => <integer>, // REQUIRED ], // ... ], 'TargetTrackingConfiguration' => [ 'CustomizedMetricSpecification' => [ 'Dimensions' => [ [ 'Name' => '<string>', // REQUIRED 'Value' => '<string>', // REQUIRED ], // ... ], 'MetricName' => '<string>', // REQUIRED 'Namespace' => '<string>', // REQUIRED 'Statistic' => 'Average|Minimum|Maximum|SampleCount|Sum', // REQUIRED 'Unit' => '<string>', ], 'DisableScaleIn' => true || false, 'PredefinedMetricSpecification' => [ 'PredefinedMetricType' => 'ASGAverageCPUUtilization|ASGAverageNetworkIn|ASGAverageNetworkOut|ALBRequestCountPerTarget', // REQUIRED 'ResourceLabel' => '<string>', ], 'TargetValue' => <float>, // REQUIRED ], ]);
Parameter Details
Members
- AdjustmentType
-
- Type: string
Specifies whether the
ScalingAdjustment
parameter is an absolute number or a percentage of the current capacity. The valid values areChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
.Valid only if the policy type is
StepScaling
orSimpleScaling
. For more information, see Scaling Adjustment Types in the Amazon EC2 Auto Scaling User Guide. - AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- Cooldown
-
- Type: int
The amount of time, in seconds, after a scaling activity completes before any further dynamic scaling activities can start. If this parameter is not specified, the default cooldown period for the group applies.
Valid only if the policy type is
SimpleScaling
. For more information, see Scaling Cooldowns in the Amazon EC2 Auto Scaling User Guide. - EstimatedInstanceWarmup
-
- Type: int
The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. The default is to use the value specified for the default cooldown period for the group.
Valid only if the policy type is
StepScaling
orTargetTrackingScaling
. - MetricAggregationType
-
- Type: string
The aggregation type for the CloudWatch metrics. The valid values are
Minimum
,Maximum
, andAverage
. If the aggregation type is null, the value is treated asAverage
.Valid only if the policy type is
StepScaling
. - MinAdjustmentMagnitude
-
- Type: int
The minimum number of instances to scale. If the value of
AdjustmentType
isPercentChangeInCapacity
, the scaling policy changes theDesiredCapacity
of the Auto Scaling group by at least this many instances. Otherwise, the error isValidationError
.This property replaces the
MinAdjustmentStep
property. For example, suppose that you create a step scaling policy to scale out an Auto Scaling group by 25 percent and you specify aMinAdjustmentMagnitude
of 2. If the group has 4 instances and the scaling policy is performed, 25 percent of 4 is 1. However, because you specified aMinAdjustmentMagnitude
of 2, Amazon EC2 Auto Scaling scales out the group by 2 instances.Valid only if the policy type is
SimpleScaling
orStepScaling
. - MinAdjustmentStep
-
- Type: int
Available for backward compatibility. Use
MinAdjustmentMagnitude
instead. - PolicyName
-
- Required: Yes
- Type: string
The name of the policy.
- PolicyType
-
- Type: string
The policy type. The valid values are
SimpleScaling
,StepScaling
, andTargetTrackingScaling
. If the policy type is null, the value is treated asSimpleScaling
. - ScalingAdjustment
-
- Type: int
The amount by which a simple scaling policy scales the Auto Scaling group in response to an alarm breach. The adjustment is based on the value that you specified in the
AdjustmentType
parameter (either an absolute number or a percentage). A positive value adds to the current capacity and a negative value subtracts from the current capacity. For exact capacity, you must specify a positive value.Conditional: If you specify
SimpleScaling
for the policy type, you must specify this parameter. (Not used with any other policy type.) - StepAdjustments
-
- Type: Array of StepAdjustment structures
A set of adjustments that enable you to scale based on the size of the alarm breach.
Conditional: If you specify
StepScaling
for the policy type, you must specify this parameter. (Not used with any other policy type.) - TargetTrackingConfiguration
-
- Type: TargetTrackingConfiguration structure
A target tracking scaling policy. Includes support for predefined or customized metrics.
For more information, see TargetTrackingConfiguration in the Amazon EC2 Auto Scaling API Reference.
Conditional: If you specify
TargetTrackingScaling
for the policy type, you must specify this parameter. (Not used with any other policy type.)
Result Syntax
[ 'Alarms' => [ [ 'AlarmARN' => '<string>', 'AlarmName' => '<string>', ], // ... ], 'PolicyARN' => '<string>', ]
Result Details
Members
- Alarms
-
- Type: Array of Alarm structures
The CloudWatch alarms created for the target tracking scaling policy.
- PolicyARN
-
- Type: string
The Amazon Resource Name (ARN) of the policy.
Errors
-
You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits.
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
-
The service-linked role is not yet ready for use.
Examples
Example 1: To add a scaling policy to an Auto Scaling group
This example adds the specified policy to the specified Auto Scaling group.
$result = $client->putScalingPolicy([ 'AdjustmentType' => 'ChangeInCapacity', 'AutoScalingGroupName' => 'my-auto-scaling-group', 'PolicyName' => 'ScaleIn', 'ScalingAdjustment' => -1, ]);
Result syntax:
[ 'PolicyARN' => 'arn:aws:autoscaling:us-west-2:123456789012:scalingPolicy:2233f3d7-6290-403b-b632-93c553560106:autoScalingGroupName/my-auto-scaling-group:policyName/ScaleIn', ]
PutScheduledUpdateGroupAction
$result = $client->putScheduledUpdateGroupAction
([/* ... */]); $promise = $client->putScheduledUpdateGroupActionAsync
([/* ... */]);
Creates or updates a scheduled scaling action for an Auto Scaling group. If you leave a parameter unspecified when updating a scheduled scaling action, the corresponding value remains unchanged.
For more information, see Scheduled Scaling in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->putScheduledUpdateGroupAction([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'DesiredCapacity' => <integer>, 'EndTime' => <integer || string || DateTime>, 'MaxSize' => <integer>, 'MinSize' => <integer>, 'Recurrence' => '<string>', 'ScheduledActionName' => '<string>', // REQUIRED 'StartTime' => <integer || string || DateTime>, 'Time' => <integer || string || DateTime>, ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- DesiredCapacity
-
- Type: int
The number of EC2 instances that should be running in the Auto Scaling group.
- EndTime
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The date and time for the recurring schedule to end. Amazon EC2 Auto Scaling does not perform the action after this time.
- MaxSize
-
- Type: int
The maximum number of instances in the Auto Scaling group.
- MinSize
-
- Type: int
The minimum number of instances in the Auto Scaling group.
- Recurrence
-
- Type: string
The recurring schedule for this action, in Unix cron syntax format. This format consists of five fields separated by white spaces: [Minute] [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example,
"30 0 1 1,6,12 *"
). For more information about this format, see Crontab.When
StartTime
andEndTime
are specified withRecurrence
, they form the boundaries of when the recurring action starts and stops. - ScheduledActionName
-
- Required: Yes
- Type: string
The name of this scaling action.
- StartTime
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The date and time for this action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT only and in quotes (for example,
"2019-06-01T00:00:00Z"
).If you specify
Recurrence
andStartTime
, Amazon EC2 Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence.If you try to schedule your action in the past, Amazon EC2 Auto Scaling returns an error message.
- Time
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
This parameter is no longer used.
Result Syntax
[]
Result Details
Errors
-
You already have an Auto Scaling group or launch configuration with this name.
-
You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits.
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To add a scheduled action to an Auto Scaling group
This example adds the specified scheduled action to the specified Auto Scaling group.
$result = $client->putScheduledUpdateGroupAction([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'DesiredCapacity' => 4, 'EndTime' =>, 'MaxSize' => 6, 'MinSize' => 2, 'ScheduledActionName' => 'my-scheduled-action', 'StartTime' => , ]);
RecordLifecycleActionHeartbeat
$result = $client->recordLifecycleActionHeartbeat
([/* ... */]); $promise = $client->recordLifecycleActionHeartbeatAsync
([/* ... */]);
Records a heartbeat for the lifecycle action associated with the specified token or instance. This extends the timeout by the length of time defined using PutLifecycleHook.
This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:
-
(Optional) Create a Lambda function and a rule that allows CloudWatch Events to invoke your Lambda function when Amazon EC2 Auto Scaling launches or terminates instances.
-
(Optional) Create a notification target and an IAM role. The target can be either an Amazon SQS queue or an Amazon SNS topic. The role allows Amazon EC2 Auto Scaling to publish lifecycle notifications to the target.
-
Create the lifecycle hook. Specify whether the hook is used when the instances launch or terminate.
-
If you need more time, record the lifecycle action heartbeat to keep the instance in a pending state.
-
If you finish before the timeout period ends, complete the lifecycle action.
For more information, see Auto Scaling Lifecycle in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->recordLifecycleActionHeartbeat([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'InstanceId' => '<string>', 'LifecycleActionToken' => '<string>', 'LifecycleHookName' => '<string>', // REQUIRED ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- InstanceId
-
- Type: string
The ID of the instance.
- LifecycleActionToken
-
- Type: string
A token that uniquely identifies a specific lifecycle action associated with an instance. Amazon EC2 Auto Scaling sends this token to the notification target that you specified when you created the lifecycle hook.
- LifecycleHookName
-
- Required: Yes
- Type: string
The name of the lifecycle hook.
Result Syntax
[]
Result Details
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To record a lifecycle action heartbeat
This example records a lifecycle action heartbeat to keep the instance in a pending state.
$result = $client->recordLifecycleActionHeartbeat([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'LifecycleActionToken' => 'bcd2f1b8-9a78-44d3-8a7a-4dd07d7cf635', 'LifecycleHookName' => 'my-lifecycle-hook', ]);
ResumeProcesses
$result = $client->resumeProcesses
([/* ... */]); $promise = $client->resumeProcessesAsync
([/* ... */]);
Resumes the specified suspended automatic scaling processes, or all suspended process, for the specified Auto Scaling group.
For more information, see Suspending and Resuming Scaling Processes in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->resumeProcesses([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'ScalingProcesses' => ['<string>', ...], ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- ScalingProcesses
-
- Type: Array of strings
One or more of the following processes. If you omit this parameter, all processes are specified.
-
Launch
-
Terminate
-
HealthCheck
-
ReplaceUnhealthy
-
AZRebalance
-
AlarmNotification
-
ScheduledActions
-
AddToLoadBalancer
Result Syntax
[]
Result Details
Errors
-
The operation can't be performed because the resource is in use.
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To resume Auto Scaling processes
This example resumes the specified suspended scaling process for the specified Auto Scaling group.
$result = $client->resumeProcesses([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'ScalingProcesses' => [ 'AlarmNotification', ], ]);
SetDesiredCapacity
$result = $client->setDesiredCapacity
([/* ... */]); $promise = $client->setDesiredCapacityAsync
([/* ... */]);
Sets the size of the specified Auto Scaling group.
For more information about desired capacity, see What Is Amazon EC2 Auto Scaling? in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->setDesiredCapacity([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'DesiredCapacity' => <integer>, // REQUIRED 'HonorCooldown' => true || false, ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- DesiredCapacity
-
- Required: Yes
- Type: int
The number of EC2 instances that should be running in the Auto Scaling group.
- HonorCooldown
-
- Type: boolean
Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before initiating a scaling activity to set your Auto Scaling group to its new capacity. By default, Amazon EC2 Auto Scaling does not honor the cooldown period during manual scaling activities.
Result Syntax
[]
Result Details
Errors
-
ScalingActivityInProgressFault:
The operation can't be performed because there are scaling activities in progress.
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To set the desired capacity for an Auto Scaling group
This example sets the desired capacity for the specified Auto Scaling group.
$result = $client->setDesiredCapacity([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'DesiredCapacity' => 2, 'HonorCooldown' => 1, ]);
SetInstanceHealth
$result = $client->setInstanceHealth
([/* ... */]); $promise = $client->setInstanceHealthAsync
([/* ... */]);
Sets the health status of the specified instance.
For more information, see Health Checks for Auto Scaling Instances in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->setInstanceHealth([ 'HealthStatus' => '<string>', // REQUIRED 'InstanceId' => '<string>', // REQUIRED 'ShouldRespectGracePeriod' => true || false, ]);
Parameter Details
Members
- HealthStatus
-
- Required: Yes
- Type: string
The health status of the instance. Set to
Healthy
to have the instance remain in service. Set toUnhealthy
to have the instance be out of service. Amazon EC2 Auto Scaling terminates and replaces the unhealthy instance. - InstanceId
-
- Required: Yes
- Type: string
The ID of the instance.
- ShouldRespectGracePeriod
-
- Type: boolean
If the Auto Scaling group of the specified instance has a
HealthCheckGracePeriod
specified for the group, by default, this call respects the grace period. Set this toFalse
, to have the call not respect the grace period associated with the group.For more information about the health check grace period, see CreateAutoScalingGroup.
Result Syntax
[]
Result Details
Errors
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To set the health status of an instance
This example sets the health status of the specified instance to Unhealthy.
$result = $client->setInstanceHealth([ 'HealthStatus' => 'Unhealthy', 'InstanceId' => 'i-93633f9b', ]);
SetInstanceProtection
$result = $client->setInstanceProtection
([/* ... */]); $promise = $client->setInstanceProtectionAsync
([/* ... */]);
Updates the instance protection settings of the specified instances.
For more information about preventing instances that are part of an Auto Scaling group from terminating on scale in, see Instance Protection in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->setInstanceProtection([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'InstanceIds' => ['<string>', ...], // REQUIRED 'ProtectedFromScaleIn' => true || false, // REQUIRED ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- InstanceIds
-
- Required: Yes
- Type: Array of strings
One or more instance IDs.
- ProtectedFromScaleIn
-
- Required: Yes
- Type: boolean
Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in.
Result Syntax
[]
Result Details
Errors
-
You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits.
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To enable instance protection for an instance
This example enables instance protection for the specified instance.
$result = $client->setInstanceProtection([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'InstanceIds' => [ 'i-93633f9b', ], 'ProtectedFromScaleIn' => 1, ]);
Example 2: To disable instance protection for an instance
This example disables instance protection for the specified instance.
$result = $client->setInstanceProtection([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'InstanceIds' => [ 'i-93633f9b', ], 'ProtectedFromScaleIn' => , ]);
SuspendProcesses
$result = $client->suspendProcesses
([/* ... */]); $promise = $client->suspendProcessesAsync
([/* ... */]);
Suspends the specified automatic scaling processes, or all processes, for the specified Auto Scaling group.
If you suspend either the Launch
or Terminate
process types, it can prevent other process types from functioning properly.
To resume processes that have been suspended, use ResumeProcesses.
For more information, see Suspending and Resuming Scaling Processes in the Amazon EC2 Auto Scaling User Guide.
Parameter Syntax
$result = $client->suspendProcesses([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'ScalingProcesses' => ['<string>', ...], ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- ScalingProcesses
-
- Type: Array of strings
One or more of the following processes. If you omit this parameter, all processes are specified.
-
Launch
-
Terminate
-
HealthCheck
-
ReplaceUnhealthy
-
AZRebalance
-
AlarmNotification
-
ScheduledActions
-
AddToLoadBalancer
Result Syntax
[]
Result Details
Errors
-
The operation can't be performed because the resource is in use.
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To suspend Auto Scaling processes
This example suspends the specified scaling process for the specified Auto Scaling group.
$result = $client->suspendProcesses([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'ScalingProcesses' => [ 'AlarmNotification', ], ]);
TerminateInstanceInAutoScalingGroup
$result = $client->terminateInstanceInAutoScalingGroup
([/* ... */]); $promise = $client->terminateInstanceInAutoScalingGroupAsync
([/* ... */]);
Terminates the specified instance and optionally adjusts the desired group size.
This call simply makes a termination request. The instance is not terminated immediately.
Parameter Syntax
$result = $client->terminateInstanceInAutoScalingGroup([ 'InstanceId' => '<string>', // REQUIRED 'ShouldDecrementDesiredCapacity' => true || false, // REQUIRED ]);
Parameter Details
Members
Result Syntax
[ 'Activity' => [ 'ActivityId' => '<string>', 'AutoScalingGroupName' => '<string>', 'Cause' => '<string>', 'Description' => '<string>', 'Details' => '<string>', 'EndTime' => <DateTime>, 'Progress' => <integer>, 'StartTime' => <DateTime>, 'StatusCode' => 'PendingSpotBidPlacement|WaitingForSpotInstanceRequestId|WaitingForSpotInstanceId|WaitingForInstanceId|PreInService|InProgress|WaitingForELBConnectionDraining|MidLifecycleAction|WaitingForInstanceWarmup|Successful|Failed|Cancelled', 'StatusMessage' => '<string>', ], ]
Result Details
Members
- Activity
-
- Type: Activity structure
A scaling activity.
Errors
-
ScalingActivityInProgressFault:
The operation can't be performed because there are scaling activities in progress.
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Examples
Example 1: To terminate an instance in an Auto Scaling group
This example terminates the specified instance from the specified Auto Scaling group without updating the size of the group. Auto Scaling launches a replacement instance after the specified instance terminates.
$result = $client->terminateInstanceInAutoScalingGroup([ 'InstanceId' => 'i-93633f9b', 'ShouldDecrementDesiredCapacity' => , ]);
UpdateAutoScalingGroup
$result = $client->updateAutoScalingGroup
([/* ... */]); $promise = $client->updateAutoScalingGroupAsync
([/* ... */]);
Updates the configuration for the specified Auto Scaling group.
To update an Auto Scaling group, specify the name of the group and the parameter that you want to change. Any parameters that you don't specify are not changed by this update request. The new settings take effect on any scaling activities after this call returns.
If you associate a new launch configuration or template with an Auto Scaling group, all new instances will get the updated configuration. Existing instances continue to run with the configuration that they were originally launched with. When you update a group to specify a mixed instances policy instead of a launch configuration or template, existing instances may be replaced to match the new purchasing options that you specified in the policy. For example, if the group currently has 100% On-Demand capacity and the policy specifies 50% Spot capacity, this means that half of your instances will be gradually terminated and relaunched as Spot Instances. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones, so that updating your group does not compromise the performance or availability of your application.
Note the following about changing DesiredCapacity
, MaxSize
, or MinSize
:
-
If a scale-in event occurs as a result of a new
DesiredCapacity
value that is lower than the current size of the group, the Auto Scaling group uses its termination policy to determine which instances to terminate. -
If you specify a new value for
MinSize
without specifying a value forDesiredCapacity
, and the newMinSize
is larger than the current size of the group, this sets the group'sDesiredCapacity
to the newMinSize
value. -
If you specify a new value for
MaxSize
without specifying a value forDesiredCapacity
, and the newMaxSize
is smaller than the current size of the group, this sets the group'sDesiredCapacity
to the newMaxSize
value.
To see which parameters have been set, use DescribeAutoScalingGroups. You can also view the scaling policies for an Auto Scaling group using DescribePolicies. If the group has scaling policies, you can update them using PutScalingPolicy.
Parameter Syntax
$result = $client->updateAutoScalingGroup([ 'AutoScalingGroupName' => '<string>', // REQUIRED 'AvailabilityZones' => ['<string>', ...], 'DefaultCooldown' => <integer>, 'DesiredCapacity' => <integer>, 'HealthCheckGracePeriod' => <integer>, 'HealthCheckType' => '<string>', 'LaunchConfigurationName' => '<string>', 'LaunchTemplate' => [ 'LaunchTemplateId' => '<string>', 'LaunchTemplateName' => '<string>', 'Version' => '<string>', ], 'MaxInstanceLifetime' => <integer>, 'MaxSize' => <integer>, 'MinSize' => <integer>, 'MixedInstancesPolicy' => [ 'InstancesDistribution' => [ 'OnDemandAllocationStrategy' => '<string>', 'OnDemandBaseCapacity' => <integer>, 'OnDemandPercentageAboveBaseCapacity' => <integer>, 'SpotAllocationStrategy' => '<string>', 'SpotInstancePools' => <integer>, 'SpotMaxPrice' => '<string>', ], 'LaunchTemplate' => [ 'LaunchTemplateSpecification' => [ 'LaunchTemplateId' => '<string>', 'LaunchTemplateName' => '<string>', 'Version' => '<string>', ], 'Overrides' => [ [ 'InstanceType' => '<string>', 'WeightedCapacity' => '<string>', ], // ... ], ], ], 'NewInstancesProtectedFromScaleIn' => true || false, 'PlacementGroup' => '<string>', 'ServiceLinkedRoleARN' => '<string>', 'TerminationPolicies' => ['<string>', ...], 'VPCZoneIdentifier' => '<string>', ]);
Parameter Details
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- AvailabilityZones
-
- Type: Array of strings
One or more Availability Zones for the group.
- DefaultCooldown
-
- Type: int
The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. The default value is
300
. This cooldown period is not used when a scaling-specific cooldown is specified.Cooldown periods are not supported for target tracking scaling policies, step scaling policies, or scheduled scaling. For more information, see Scaling Cooldowns in the Amazon EC2 Auto Scaling User Guide.
- DesiredCapacity
-
- Type: int
The number of EC2 instances that should be running in the Auto Scaling group. This number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group.
- HealthCheckGracePeriod
-
- Type: int
The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an EC2 instance that has come into service. The default value is
0
.For more information, see Health Check Grace Period in the Amazon EC2 Auto Scaling User Guide.
Conditional: This parameter is required if you are adding an
ELB
health check. - HealthCheckType
-
- Type: string
The service to use for the health checks. The valid values are
EC2
andELB
. If you configure an Auto Scaling group to use ELB health checks, it considers the instance unhealthy if it fails either the EC2 status checks or the load balancer health checks. - LaunchConfigurationName
-
- Type: string
The name of the launch configuration. If you specify
LaunchConfigurationName
in your update request, you can't specifyLaunchTemplate
orMixedInstancesPolicy
. - LaunchTemplate
-
- Type: LaunchTemplateSpecification structure
The launch template and version to use to specify the updates. If you specify
LaunchTemplate
in your update request, you can't specifyLaunchConfigurationName
orMixedInstancesPolicy
.For more information, see LaunchTemplateSpecification in the Amazon EC2 Auto Scaling API Reference.
- MaxInstanceLifetime
-
- Type: int
The maximum amount of time, in seconds, that an instance can be in service.
Valid Range: Minimum value of 604800.
- MaxSize
-
- Type: int
The maximum size of the Auto Scaling group.
- MinSize
-
- Type: int
The minimum size of the Auto Scaling group.
- MixedInstancesPolicy
-
- Type: MixedInstancesPolicy structure
An embedded object that specifies a mixed instances policy.
In your call to
UpdateAutoScalingGroup
, you can make changes to the policy that is specified. All optional parameters are left unchanged if not specified.For more information, see MixedInstancesPolicy in the Amazon EC2 Auto Scaling API Reference and Auto Scaling Groups with Multiple Instance Types and Purchase Options in the Amazon EC2 Auto Scaling User Guide.
- NewInstancesProtectedFromScaleIn
-
- Type: boolean
Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.
For more information about preventing instances from terminating on scale in, see Instance Protection in the Amazon EC2 Auto Scaling User Guide.
- PlacementGroup
-
- Type: string
The name of the placement group into which to launch your instances, if any. A placement group is a logical grouping of instances within a single Availability Zone. You cannot specify multiple Availability Zones and a placement group. For more information, see Placement Groups in the Amazon EC2 User Guide for Linux Instances.
- ServiceLinkedRoleARN
-
- Type: string
The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other AWS services on your behalf. For more information, see Service-Linked Roles in the Amazon EC2 Auto Scaling User Guide.
- TerminationPolicies
-
- Type: Array of strings
A standalone termination policy or a list of termination policies used to select the instance to terminate. The policies are executed in the order that they are listed.
For more information, see Controlling Which Instances Auto Scaling Terminates During Scale In in the Amazon EC2 Auto Scaling User Guide.
- VPCZoneIdentifier
-
- Type: string
A comma-separated list of subnet IDs for virtual private cloud (VPC).
If you specify
VPCZoneIdentifier
withAvailabilityZones
, the subnets that you specify for this parameter must reside in those Availability Zones.
Result Syntax
[]
Result Details
Errors
-
ScalingActivityInProgressFault:
The operation can't be performed because there are scaling activities in progress.
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
-
The service-linked role is not yet ready for use.
Examples
Example 1: To update the launch configuration
This example updates the launch configuration of the specified Auto Scaling group.
$result = $client->updateAutoScalingGroup([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'LaunchConfigurationName' => 'new-launch-config', ]);
Example 2: To update the minimum and maximum size
This example updates the minimum size and maximum size of the specified Auto Scaling group.
$result = $client->updateAutoScalingGroup([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'MaxSize' => 3, 'MinSize' => 1, ]);
Example 3: To enable instance protection
This example enables instance protection for the specified Auto Scaling group.
$result = $client->updateAutoScalingGroup([ 'AutoScalingGroupName' => 'my-auto-scaling-group', 'NewInstancesProtectedFromScaleIn' => 1, ]);
Shapes
ActivitiesType
Members
- Activities
-
- Required: Yes
- Type: Array of Activity structures
The scaling activities. Activities are sorted by start time. Activities still in progress are described first.
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
Activity
Description
Describes scaling activity, which is a long-running process that represents a change to your Auto Scaling group, such as changing its size or replacing an instance.
Members
- ActivityId
-
- Required: Yes
- Type: string
The ID of the activity.
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- Cause
-
- Required: Yes
- Type: string
The reason the activity began.
- Description
-
- Type: string
A friendly, more verbose description of the activity.
- Details
-
- Type: string
The details about the activity.
- EndTime
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The end time of the activity.
- Progress
-
- Type: int
A value between 0 and 100 that indicates the progress of the activity.
- StartTime
-
- Required: Yes
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The start time of the activity.
- StatusCode
-
- Required: Yes
- Type: string
The current status of the activity.
- StatusMessage
-
- Type: string
A friendly, more verbose description of the activity status.
ActivityType
Members
- Activity
-
- Type: Activity structure
A scaling activity.
AdjustmentType
Description
Describes a policy adjustment type.
Members
Alarm
Description
Describes an alarm.
Members
AlreadyExistsFault
Description
You already have an Auto Scaling group or launch configuration with this name.
Members
AttachLoadBalancerTargetGroupsResultType
Members
AttachLoadBalancersResultType
Members
AutoScalingGroup
Description
Describes an Auto Scaling group.
Members
- AutoScalingGroupARN
-
- Type: string
The Amazon Resource Name (ARN) of the Auto Scaling group.
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group.
- AvailabilityZones
-
- Required: Yes
- Type: Array of strings
One or more Availability Zones for the group.
- CreatedTime
-
- Required: Yes
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The date and time the group was created.
- DefaultCooldown
-
- Required: Yes
- Type: int
The amount of time, in seconds, after a scaling activity completes before another scaling activity can start.
- DesiredCapacity
-
- Required: Yes
- Type: int
The desired size of the group.
- EnabledMetrics
-
- Type: Array of EnabledMetric structures
The metrics enabled for the group.
- HealthCheckGracePeriod
-
- Type: int
The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an EC2 instance that has come into service.
- HealthCheckType
-
- Required: Yes
- Type: string
The service to use for the health checks. The valid values are
EC2
andELB
. If you configure an Auto Scaling group to use ELB health checks, it considers the instance unhealthy if it fails either the EC2 status checks or the load balancer health checks. - Instances
-
- Type: Array of Instance structures
The EC2 instances associated with the group.
- LaunchConfigurationName
-
- Type: string
The name of the associated launch configuration.
- LaunchTemplate
-
- Type: LaunchTemplateSpecification structure
The launch template for the group.
- LoadBalancerNames
-
- Type: Array of strings
One or more load balancers associated with the group.
- MaxInstanceLifetime
-
- Type: int
The maximum amount of time, in seconds, that an instance can be in service.
Valid Range: Minimum value of 604800.
- MaxSize
-
- Required: Yes
- Type: int
The maximum size of the group.
- MinSize
-
- Required: Yes
- Type: int
The minimum size of the group.
- MixedInstancesPolicy
-
- Type: MixedInstancesPolicy structure
The mixed instances policy for the group.
- NewInstancesProtectedFromScaleIn
-
- Type: boolean
Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.
- PlacementGroup
-
- Type: string
The name of the placement group into which to launch your instances, if any.
- ServiceLinkedRoleARN
-
- Type: string
The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other AWS services on your behalf.
- Status
-
- Type: string
The current state of the group when DeleteAutoScalingGroup is in progress.
- SuspendedProcesses
-
- Type: Array of SuspendedProcess structures
The suspended processes associated with the group.
- Tags
-
- Type: Array of TagDescription structures
The tags for the group.
- TargetGroupARNs
-
- Type: Array of strings
The Amazon Resource Names (ARN) of the target groups for your load balancer.
- TerminationPolicies
-
- Type: Array of strings
The termination policies for the group.
- VPCZoneIdentifier
-
- Type: string
One or more subnet IDs, if applicable, separated by commas.
AutoScalingGroupsType
Members
- AutoScalingGroups
-
- Required: Yes
- Type: Array of AutoScalingGroup structures
The groups.
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
AutoScalingInstanceDetails
Description
Describes an EC2 instance associated with an Auto Scaling group.
Members
- AutoScalingGroupName
-
- Required: Yes
- Type: string
The name of the Auto Scaling group for the instance.
- AvailabilityZone
-
- Required: Yes
- Type: string
The Availability Zone for the instance.
- HealthStatus
-
- Required: Yes
- Type: string
The last reported health status of this instance. "Healthy" means that the instance is healthy and should remain in service. "Unhealthy" means that the instance is unhealthy and Amazon EC2 Auto Scaling should terminate and replace it.
- InstanceId
-
- Required: Yes
- Type: string
The ID of the instance.
- InstanceType
-
- Type: string
The instance type of the EC2 instance.
- LaunchConfigurationName
-
- Type: string
The launch configuration used to launch the instance. This value is not available if you attached the instance to the Auto Scaling group.
- LaunchTemplate
-
- Type: LaunchTemplateSpecification structure
The launch template for the instance.
- LifecycleState
-
- Required: Yes
- Type: string
The lifecycle state for the instance.
- ProtectedFromScaleIn
-
- Required: Yes
- Type: boolean
Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in.
- WeightedCapacity
-
- Type: string
The number of capacity units contributed by the instance based on its instance type.
Valid Range: Minimum value of 1. Maximum value of 999.
AutoScalingInstancesType
Members
- AutoScalingInstances
-
- Type: Array of AutoScalingInstanceDetails structures
The instances.
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
BatchDeleteScheduledActionAnswer
Members
- FailedScheduledActions
-
- Type: Array of FailedScheduledUpdateGroupActionRequest structures
The names of the scheduled actions that could not be deleted, including an error message.
BatchPutScheduledUpdateGroupActionAnswer
Members
- FailedScheduledUpdateGroupActions
-
- Type: Array of FailedScheduledUpdateGroupActionRequest structures
The names of the scheduled actions that could not be created or updated, including an error message.
BlockDeviceMapping
Description
Describes a block device mapping.
Members
- DeviceName
-
- Required: Yes
- Type: string
The device name exposed to the EC2 instance (for example,
/dev/sdh
orxvdh
). For more information, see Device Naming on Linux Instances in the Amazon EC2 User Guide for Linux Instances. - Ebs
-
- Type: Ebs structure
The information about the Amazon EBS volume.
- NoDevice
-
- Type: boolean
Suppresses a device mapping.
If this parameter is true for the root device, the instance might fail the EC2 health check. In that case, Amazon EC2 Auto Scaling launches a replacement instance.
- VirtualName
-
- Type: string
The name of the virtual device (for example,
ephemeral0
).
CompleteLifecycleActionAnswer
Members
CustomizedMetricSpecification
Description
Represents a CloudWatch metric of your choosing for a target tracking scaling policy to use with Amazon EC2 Auto Scaling.
To create your customized metric specification:
-
Add values for each required parameter from CloudWatch. You can use an existing metric, or a new metric that you create. To use your own metric, you must first publish the metric to CloudWatch. For more information, see Publish Custom Metrics in the Amazon CloudWatch User Guide.
-
Choose a metric that changes proportionally with capacity. The value of the metric should increase or decrease in inverse proportion to the number of capacity units. That is, the value of the metric should decrease when capacity increases.
For more information about CloudWatch, see Amazon CloudWatch Concepts.
Members
- Dimensions
-
- Type: Array of MetricDimension structures
The dimensions of the metric.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
- MetricName
-
- Required: Yes
- Type: string
The name of the metric.
- Namespace
-
- Required: Yes
- Type: string
The namespace of the metric.
- Statistic
-
- Required: Yes
- Type: string
The statistic of the metric.
- Unit
-
- Type: string
The unit of the metric.
DeleteLifecycleHookAnswer
Members
DescribeAccountLimitsAnswer
Members
- MaxNumberOfAutoScalingGroups
-
- Type: int
The maximum number of groups allowed for your AWS account. The default limit is 200 per AWS Region.
- MaxNumberOfLaunchConfigurations
-
- Type: int
The maximum number of launch configurations allowed for your AWS account. The default limit is 200 per AWS Region.
- NumberOfAutoScalingGroups
-
- Type: int
The current number of groups for your AWS account.
- NumberOfLaunchConfigurations
-
- Type: int
The current number of launch configurations for your AWS account.
DescribeAdjustmentTypesAnswer
Members
- AdjustmentTypes
-
- Type: Array of AdjustmentType structures
The policy adjustment types.
DescribeAutoScalingNotificationTypesAnswer
DescribeLifecycleHookTypesAnswer
DescribeLifecycleHooksAnswer
Members
- LifecycleHooks
-
- Type: Array of LifecycleHook structures
The lifecycle hooks for the specified group.
DescribeLoadBalancerTargetGroupsResponse
Members
- LoadBalancerTargetGroups
-
- Type: Array of LoadBalancerTargetGroupState structures
Information about the target groups.
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
DescribeLoadBalancersResponse
Members
- LoadBalancers
-
- Type: Array of LoadBalancerState structures
The load balancers.
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
DescribeMetricCollectionTypesAnswer
Members
- Granularities
-
- Type: Array of MetricGranularityType structures
The granularities for the metrics.
- Metrics
-
- Type: Array of MetricCollectionType structures
One or more metrics.
DescribeNotificationConfigurationsAnswer
Members
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return. - NotificationConfigurations
-
- Required: Yes
- Type: Array of NotificationConfiguration structures
The notification configurations.
DescribeTerminationPolicyTypesAnswer
Members
DetachInstancesAnswer
Members
- Activities
-
- Type: Array of Activity structures
The activities related to detaching the instances from the Auto Scaling group.
DetachLoadBalancerTargetGroupsResultType
Members
DetachLoadBalancersResultType
Members
Ebs
Description
Describes an Amazon EBS volume. Used in combination with BlockDeviceMapping.
Members
- DeleteOnTermination
-
- Type: boolean
Indicates whether the volume is deleted on instance termination. For Amazon EC2 Auto Scaling, the default value is
true
. - Encrypted
-
- Type: boolean
Specifies whether the volume should be encrypted. Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption. For more information, see Supported Instance Types. If your AMI uses encrypted volumes, you can also only launch it on supported instance types.
If you are creating a volume from a snapshot, you cannot specify an encryption value. Volumes that are created from encrypted snapshots are automatically encrypted, and volumes that are created from unencrypted snapshots are automatically unencrypted. By default, encrypted snapshots use the AWS managed CMK that is used for EBS encryption, but you can specify a custom CMK when you create the snapshot. The ability to encrypt a snapshot during copying also allows you to apply a new CMK to an already-encrypted snapshot. Volumes restored from the resulting copy are only accessible using the new CMK.
Enabling encryption by default results in all EBS volumes being encrypted with the AWS managed CMK or a customer managed CMK, whether or not the snapshot was encrypted.
For more information, see Using Encryption with EBS-Backed AMIs in the Amazon EC2 User Guide for Linux Instances and Required CMK Key Policy for Use with Encrypted Volumes in the Amazon EC2 Auto Scaling User Guide.
- Iops
-
- Type: int
The number of I/O operations per second (IOPS) to provision for the volume. The maximum ratio of IOPS to volume size (in GiB) is 50:1. For more information, see Amazon EBS Volume Types in the Amazon EC2 User Guide for Linux Instances.
Conditional: This parameter is required when the volume type is
io1
. (Not used withstandard
,gp2
,st1
, orsc1
volumes.) - SnapshotId
-
- Type: string
The snapshot ID of the volume to use.
Conditional: This parameter is optional if you specify a volume size. If you specify both
SnapshotId
andVolumeSize
,VolumeSize
must be equal or greater than the size of the snapshot. - VolumeSize
-
- Type: int
The volume size, in Gibibytes (GiB).
This can be a number from 1-1,024 for
standard
, 4-16,384 forio1
, 1-16,384 forgp2
, and 500-16,384 forst1
andsc1
. If you specify a snapshot, the volume size must be equal to or larger than the snapshot size.Default: If you create a volume from a snapshot and you don't specify a volume size, the default is the snapshot size.
At least one of VolumeSize or SnapshotId is required.
- VolumeType
-
- Type: string
The volume type, which can be
standard
for Magnetic,io1
for Provisioned IOPS SSD,gp2
for General Purpose SSD,st1
for Throughput Optimized HDD, orsc1
for Cold HDD. For more information, see Amazon EBS Volume Types in the Amazon EC2 User Guide for Linux Instances.Valid Values:
standard
|io1
|gp2
|st1
|sc1
EnabledMetric
Description
Describes an enabled metric.
Members
EnterStandbyAnswer
Members
- Activities
-
- Type: Array of Activity structures
The activities related to moving instances into
Standby
mode.
ExitStandbyAnswer
Members
- Activities
-
- Type: Array of Activity structures
The activities related to moving instances out of
Standby
mode.
FailedScheduledUpdateGroupActionRequest
Description
Describes a scheduled action that could not be created, updated, or deleted.
Members
Filter
Description
Describes a filter.
Members
Instance
Description
Describes an EC2 instance.
Members
- AvailabilityZone
-
- Required: Yes
- Type: string
The Availability Zone in which the instance is running.
- HealthStatus
-
- Required: Yes
- Type: string
The last reported health status of the instance. "Healthy" means that the instance is healthy and should remain in service. "Unhealthy" means that the instance is unhealthy and that Amazon EC2 Auto Scaling should terminate and replace it.
- InstanceId
-
- Required: Yes
- Type: string
The ID of the instance.
- InstanceType
-
- Type: string
The instance type of the EC2 instance.
- LaunchConfigurationName
-
- Type: string
The launch configuration associated with the instance.
- LaunchTemplate
-
- Type: LaunchTemplateSpecification structure
The launch template for the instance.
- LifecycleState
-
- Required: Yes
- Type: string
A description of the current lifecycle state. The
Quarantined
state is not used. - ProtectedFromScaleIn
-
- Required: Yes
- Type: boolean
Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in.
- WeightedCapacity
-
- Type: string
The number of capacity units contributed by the instance based on its instance type.
Valid Range: Minimum value of 1. Maximum value of 999.
InstanceMonitoring
Description
Describes whether detailed monitoring is enabled for the Auto Scaling instances.
Members
InstancesDistribution
Description
Describes an instances distribution for an Auto Scaling group with MixedInstancesPolicy.
The instances distribution specifies the distribution of On-Demand Instances and Spot Instances, the maximum price to pay for Spot Instances, and how the Auto Scaling group allocates instance types to fulfill On-Demand and Spot capacity.
When you update SpotAllocationStrategy
, SpotInstancePools
, or SpotMaxPrice
, this update action does not deploy any changes across the running Amazon EC2 instances in the group. Your existing Spot Instances continue to run as long as the maximum price for those instances is higher than the current Spot price. When scale out occurs, Amazon EC2 Auto Scaling launches instances based on the new settings. When scale in occurs, Amazon EC2 Auto Scaling terminates instances according to the group's termination policies.
Members
- OnDemandAllocationStrategy
-
- Type: string
Indicates how to allocate instance types to fulfill On-Demand capacity.
The only valid value is
prioritized
, which is also the default value. This strategy uses the order of instance type overrides for the LaunchTemplate to define the launch priority of each instance type. The first instance type in the array is prioritized higher than the last. If all your On-Demand capacity cannot be fulfilled using your highest priority instance, then the Auto Scaling groups launches the remaining capacity using the second priority instance type, and so on. - OnDemandBaseCapacity
-
- Type: int
The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances. This base portion is provisioned first as your group scales.
Default if not set is 0. If you leave it set to 0, On-Demand Instances are launched as a percentage of the Auto Scaling group's desired capacity, per the
OnDemandPercentageAboveBaseCapacity
setting.An update to this setting means a gradual replacement of instances to maintain the specified number of On-Demand Instances for your base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones.
- OnDemandPercentageAboveBaseCapacity
-
- Type: int
Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond
OnDemandBaseCapacity
.Default if not set is 100. If you leave it set to 100, the percentages are 100% for On-Demand Instances and 0% for Spot Instances.
An update to this setting means a gradual replacement of instances to maintain the percentage of On-Demand Instances for your additional capacity above the base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones.
Valid Range: Minimum value of 0. Maximum value of 100.
- SpotAllocationStrategy
-
- Type: string
Indicates how to allocate instances across Spot Instance pools.
If the allocation strategy is
lowest-price
, the Auto Scaling group launches instances using the Spot pools with the lowest price, and evenly allocates your instances across the number of Spot pools that you specify. If the allocation strategy iscapacity-optimized
, the Auto Scaling group launches instances using Spot pools that are optimally chosen based on the available Spot capacity.The default Spot allocation strategy for calls that you make through the API, the AWS CLI, or the AWS SDKs is
lowest-price
. The default Spot allocation strategy for the AWS Management Console iscapacity-optimized
.Valid values:
lowest-price
|capacity-optimized
- SpotInstancePools
-
- Type: int
The number of Spot Instance pools across which to allocate your Spot Instances. The Spot pools are determined from the different instance types in the Overrides array of LaunchTemplate. Default if not set is 2.
Used only when the Spot allocation strategy is
lowest-price
.Valid Range: Minimum value of 1. Maximum value of 20.
- SpotMaxPrice
-
- Type: string
The maximum price per unit hour that you are willing to pay for a Spot Instance. If you leave the value of this parameter blank (which is the default), the maximum Spot price is set at the On-Demand price.
To remove a value that you previously set, include the parameter but leave the value blank.
InvalidNextToken
LaunchConfiguration
Description
Describes a launch configuration.
Members
- AssociatePublicIpAddress
-
- Type: boolean
For Auto Scaling groups that are running in a VPC, specifies whether to assign a public IP address to the group's instances.
For more information, see Launching Auto Scaling Instances in a VPC in the Amazon EC2 Auto Scaling User Guide.
- BlockDeviceMappings
-
- Type: Array of BlockDeviceMapping structures
A block device mapping, which specifies the block devices for the instance.
For more information, see Block Device Mapping in the Amazon EC2 User Guide for Linux Instances.
- ClassicLinkVPCId
-
- Type: string
The ID of a ClassicLink-enabled VPC to link your EC2-Classic instances to.
For more information, see ClassicLink in the Amazon EC2 User Guide for Linux Instances and Linking EC2-Classic Instances to a VPC in the Amazon EC2 Auto Scaling User Guide.
- ClassicLinkVPCSecurityGroups
-
- Type: Array of strings
The IDs of one or more security groups for the VPC specified in
ClassicLinkVPCId
.For more information, see ClassicLink in the Amazon EC2 User Guide for Linux Instances and Linking EC2-Classic Instances to a VPC in the Amazon EC2 Auto Scaling User Guide.
- CreatedTime
-
- Required: Yes
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The creation date and time for the launch configuration.
- EbsOptimized
-
- Type: boolean
Specifies whether the launch configuration is optimized for EBS I/O (
true
) or not (false
).For more information, see Amazon EBS-Optimized Instances in the Amazon EC2 User Guide for Linux Instances.
- IamInstanceProfile
-
- Type: string
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.
For more information, see IAM Role for Applications That Run on Amazon EC2 Instances in the Amazon EC2 Auto Scaling User Guide.
- ImageId
-
- Required: Yes
- Type: string
The ID of the Amazon Machine Image (AMI) to use to launch your EC2 instances.
For more information, see Finding an AMI in the Amazon EC2 User Guide for Linux Instances.
- InstanceMonitoring
-
- Type: InstanceMonitoring structure
Controls whether instances in this group are launched with detailed (
true
) or basic (false
) monitoring.For more information, see Configure Monitoring for Auto Scaling Instances in the Amazon EC2 Auto Scaling User Guide.
- InstanceType
-
- Required: Yes
- Type: string
The instance type for the instances.
For information about available instance types, see Available Instance Types in the Amazon EC2 User Guide for Linux Instances.
- KernelId
-
- Type: string
The ID of the kernel associated with the AMI.
- KeyName
-
- Type: string
The name of the key pair.
For more information, see Amazon EC2 Key Pairs in the Amazon EC2 User Guide for Linux Instances.
- LaunchConfigurationARN
-
- Type: string
The Amazon Resource Name (ARN) of the launch configuration.
- LaunchConfigurationName
-
- Required: Yes
- Type: string
The name of the launch configuration.
- PlacementTenancy
-
- Type: string
The tenancy of the instance, either
default
ordedicated
. An instance withdedicated
tenancy runs on isolated, single-tenant hardware and can only be launched into a VPC.For more information, see Instance Placement Tenancy in the Amazon EC2 Auto Scaling User Guide.
- RamdiskId
-
- Type: string
The ID of the RAM disk associated with the AMI.
- SecurityGroups
-
- Type: Array of strings
A list that contains the security groups to assign to the instances in the Auto Scaling group.
For more information, see Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide.
- SpotPrice
-
- Type: string
The maximum hourly price to be paid for any Spot Instance launched to fulfill the request. Spot Instances are launched when the price you specify exceeds the current Spot price.
For more information, see Launching Spot Instances in Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide.
- UserData
-
- Type: string
The Base64-encoded user data to make available to the launched EC2 instances.
For more information, see Instance Metadata and User Data in the Amazon EC2 User Guide for Linux Instances.
LaunchConfigurationsType
Members
- LaunchConfigurations
-
- Required: Yes
- Type: Array of LaunchConfiguration structures
The launch configurations.
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
LaunchTemplate
Description
Describes a launch template and overrides.
The overrides are used to override the instance type specified by the launch template with multiple instance types that can be used to launch On-Demand Instances and Spot Instances.
When you update the launch template or overrides, existing Amazon EC2 instances continue to run. When scale out occurs, Amazon EC2 Auto Scaling launches instances to match the new settings. When scale in occurs, Amazon EC2 Auto Scaling terminates instances according to the group's termination policies.
Members
- LaunchTemplateSpecification
-
- Type: LaunchTemplateSpecification structure
The launch template to use. You must specify either the launch template ID or launch template name in the request.
- Overrides
-
- Type: Array of LaunchTemplateOverrides structures
An optional setting. Any parameters that you specify override the same parameters in the launch template. Currently, the only supported override is instance type. You can specify between 1 and 20 instance types.
LaunchTemplateOverrides
Description
Describes an override for a launch template.
Members
- InstanceType
-
- Type: string
The instance type.
For information about available instance types, see Available Instance Types in the Amazon Elastic Compute Cloud User Guide.
- WeightedCapacity
-
- Type: string
The number of capacity units, which gives the instance type a proportional weight to other instance types. For example, larger instance types are generally weighted more than smaller instance types. These are the same units that you chose to set the desired capacity in terms of instances, or a performance attribute such as vCPUs, memory, or I/O.
Valid Range: Minimum value of 1. Maximum value of 999.
LaunchTemplateSpecification
Description
Describes a launch template and the launch template version.
The launch template that is specified must be configured for use with an Auto Scaling group. For more information, see Creating a Launch Template for an Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide.
Members
- LaunchTemplateId
-
- Type: string
The ID of the launch template. You must specify either a template ID or a template name.
- LaunchTemplateName
-
- Type: string
The name of the launch template. You must specify either a template name or a template ID.
- Version
-
- Type: string
The version number,
$Latest
, or$Default
. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
LifecycleHook
Description
Describes a lifecycle hook, which tells Amazon EC2 Auto Scaling that you want to perform an action whenever it launches instances or terminates instances. Used in response to DescribeLifecycleHooks.
Members
- AutoScalingGroupName
-
- Type: string
The name of the Auto Scaling group for the lifecycle hook.
- DefaultResult
-
- Type: string
Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. The possible values are
CONTINUE
andABANDON
. - GlobalTimeout
-
- Type: int
The maximum time, in seconds, that an instance can remain in a
Pending:Wait
orTerminating:Wait
state. The maximum is 172800 seconds (48 hours) or 100 timesHeartbeatTimeout
, whichever is smaller. - HeartbeatTimeout
-
- Type: int
The maximum time, in seconds, that can elapse before the lifecycle hook times out. If the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the
DefaultResult
parameter. - LifecycleHookName
-
- Type: string
The name of the lifecycle hook.
- LifecycleTransition
-
- Type: string
The state of the EC2 instance to which to attach the lifecycle hook. The following are possible values:
-
autoscaling:EC2_INSTANCE_LAUNCHING
-
autoscaling:EC2_INSTANCE_TERMINATING
- NotificationMetadata
-
- Type: string
Additional information that is included any time Amazon EC2 Auto Scaling sends a message to the notification target.
- NotificationTargetARN
-
- Type: string
The ARN of the target that Amazon EC2 Auto Scaling sends notifications to when an instance is in the transition state for the lifecycle hook. The notification target can be either an SQS queue or an SNS topic.
- RoleARN
-
- Type: string
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
LifecycleHookSpecification
Description
Describes a lifecycle hook. Used in combination with CreateAutoScalingGroup.
A lifecycle hook tells Amazon EC2 Auto Scaling to perform an action on an instance when the instance launches (before it is put into service) or as the instance terminates (before it is fully terminated).
This step is a part of the procedure for creating a lifecycle hook for an Auto Scaling group:
-
(Optional) Create a Lambda function and a rule that allows CloudWatch Events to invoke your Lambda function when Amazon EC2 Auto Scaling launches or terminates instances.
-
(Optional) Create a notification target and an IAM role. The target can be either an Amazon SQS queue or an Amazon SNS topic. The role allows Amazon EC2 Auto Scaling to publish lifecycle notifications to the target.
-
Create the lifecycle hook. Specify whether the hook is used when the instances launch or terminate.
-
If you need more time, record the lifecycle action heartbeat to keep the instance in a pending state using RecordLifecycleActionHeartbeat.
-
If you finish before the timeout period ends, complete the lifecycle action using CompleteLifecycleAction.
For more information, see Amazon EC2 Auto Scaling Lifecycle Hooks in the Amazon EC2 Auto Scaling User Guide.
You can view the lifecycle hooks for an Auto Scaling group using DescribeLifecycleHooks. You can modify an existing lifecycle hook or create new lifecycle hooks using PutLifecycleHook. If you are no longer using a lifecycle hook, you can delete it using DeleteLifecycleHook.
Members
- DefaultResult
-
- Type: string
Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. The valid values are
CONTINUE
andABANDON
. The default value isABANDON
. - HeartbeatTimeout
-
- Type: int
The maximum time, in seconds, that can elapse before the lifecycle hook times out.
If the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the
DefaultResult
parameter. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat. - LifecycleHookName
-
- Required: Yes
- Type: string
The name of the lifecycle hook.
- LifecycleTransition
-
- Required: Yes
- Type: string
The state of the EC2 instance to which you want to attach the lifecycle hook. The valid values are:
-
autoscaling:EC2_INSTANCE_LAUNCHING
-
autoscaling:EC2_INSTANCE_TERMINATING
- NotificationMetadata
-
- Type: string
Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.
- NotificationTargetARN
-
- Type: string
The ARN of the target that Amazon EC2 Auto Scaling sends notifications to when an instance is in the transition state for the lifecycle hook. The notification target can be either an SQS queue or an SNS topic.
- RoleARN
-
- Type: string
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target, for example, an Amazon SNS topic or an Amazon SQS queue.
LimitExceededFault
Description
You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits.
Members
LoadBalancerState
Description
Describes the state of a Classic Load Balancer.
If you specify a load balancer when creating the Auto Scaling group, the state of the load balancer is InService
.
If you attach a load balancer to an existing Auto Scaling group, the initial state is Adding
. The state transitions to Added
after all instances in the group are registered with the load balancer. If Elastic Load Balancing health checks are enabled for the load balancer, the state transitions to InService
after at least one instance in the group passes the health check. If EC2 health checks are enabled instead, the load balancer remains in the Added
state.
Members
- LoadBalancerName
-
- Type: string
The name of the load balancer.
- State
-
- Type: string
One of the following load balancer states:
-
Adding
- The instances in the group are being registered with the load balancer. -
Added
- All instances in the group are registered with the load balancer. -
InService
- At least one instance in the group passed an ELB health check. -
Removing
- The instances in the group are being deregistered from the load balancer. If connection draining is enabled, Elastic Load Balancing waits for in-flight requests to complete before deregistering the instances. -
Removed
- All instances in the group are deregistered from the load balancer.
LoadBalancerTargetGroupState
Description
Describes the state of a target group.
If you attach a target group to an existing Auto Scaling group, the initial state is Adding
. The state transitions to Added
after all Auto Scaling instances are registered with the target group. If Elastic Load Balancing health checks are enabled, the state transitions to InService
after at least one Auto Scaling instance passes the health check. If EC2 health checks are enabled instead, the target group remains in the Added
state.
Members
- LoadBalancerTargetGroupARN
-
- Type: string
The Amazon Resource Name (ARN) of the target group.
- State
-
- Type: string
The state of the target group.
-
Adding
- The Auto Scaling instances are being registered with the target group. -
Added
- All Auto Scaling instances are registered with the target group. -
InService
- At least one Auto Scaling instance passed an ELB health check. -
Removing
- The Auto Scaling instances are being deregistered from the target group. If connection draining is enabled, Elastic Load Balancing waits for in-flight requests to complete before deregistering the instances. -
Removed
- All Auto Scaling instances are deregistered from the target group.
MetricCollectionType
Description
Describes a metric.
Members
MetricDimension
Description
Describes the dimension of a metric.
Members
MetricGranularityType
Description
Describes a granularity of a metric.
Members
MixedInstancesPolicy
Description
Describes a mixed instances policy for an Auto Scaling group. With mixed instances, your Auto Scaling group can provision a combination of On-Demand Instances and Spot Instances across multiple instance types. For more information, see Auto Scaling Groups with Multiple Instance Types and Purchase Options in the Amazon EC2 Auto Scaling User Guide.
You can create a mixed instances policy for a new Auto Scaling group, or you can create it for an existing group by updating the group to specify MixedInstancesPolicy
as the top-level parameter instead of a launch configuration or template. For more information, see CreateAutoScalingGroup and UpdateAutoScalingGroup.
Members
- InstancesDistribution
-
- Type: InstancesDistribution structure
The instances distribution to use.
If you leave this parameter unspecified, the value for each parameter in
InstancesDistribution
uses a default value. - LaunchTemplate
-
- Type: LaunchTemplate structure
The launch template and instance types (overrides).
This parameter must be specified when creating a mixed instances policy.
NotificationConfiguration
Description
Describes a notification.
Members
- AutoScalingGroupName
-
- Type: string
The name of the Auto Scaling group.
- NotificationType
-
- Type: string
One of the following event notification types:
-
autoscaling:EC2_INSTANCE_LAUNCH
-
autoscaling:EC2_INSTANCE_LAUNCH_ERROR
-
autoscaling:EC2_INSTANCE_TERMINATE
-
autoscaling:EC2_INSTANCE_TERMINATE_ERROR
-
autoscaling:TEST_NOTIFICATION
- TopicARN
-
- Type: string
The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (Amazon SNS) topic.
PoliciesType
Members
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return. - ScalingPolicies
-
- Type: Array of ScalingPolicy structures
The scaling policies.
PolicyARNType
Description
Contains the output of PutScalingPolicy.
Members
- Alarms
-
- Type: Array of Alarm structures
The CloudWatch alarms created for the target tracking scaling policy.
- PolicyARN
-
- Type: string
The Amazon Resource Name (ARN) of the policy.
PredefinedMetricSpecification
Description
Represents a predefined metric for a target tracking scaling policy to use with Amazon EC2 Auto Scaling.
Members
- PredefinedMetricType
-
- Required: Yes
- Type: string
The metric type. The following predefined metrics are available:
-
ASGAverageCPUUtilization
- Average CPU utilization of the Auto Scaling group. -
ASGAverageNetworkIn
- Average number of bytes received on all network interfaces by the Auto Scaling group. -
ASGAverageNetworkOut
- Average number of bytes sent out on all network interfaces by the Auto Scaling group. -
ALBRequestCountPerTarget
- Number of requests completed per target in an Application Load Balancer target group.
- ResourceLabel
-
- Type: string
Identifies the resource associated with the metric type. You can't specify a resource label unless the metric type is
ALBRequestCountPerTarget
and there is a target group attached to the Auto Scaling group.The format is
app/load-balancer-name/load-balancer-id/targetgroup/target-group-name/target-group-id
, where-
app/load-balancer-name/load-balancer-id
is the final portion of the load balancer ARN, and -
targetgroup/target-group-name/target-group-id
is the final portion of the target group ARN.
ProcessType
Description
Describes a process type.
For more information, see Scaling Processes in the Amazon EC2 Auto Scaling User Guide.
Members
ProcessesType
Members
- Processes
-
- Type: Array of ProcessType structures
The names of the process types.
PutLifecycleHookAnswer
Members
RecordLifecycleActionHeartbeatAnswer
Members
ResourceContentionFault
Description
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
Members
ResourceInUseFault
Description
The operation can't be performed because the resource is in use.
Members
ScalingActivityInProgressFault
Description
The operation can't be performed because there are scaling activities in progress.
Members
ScalingPolicy
Description
Describes a scaling policy.
Members
- AdjustmentType
-
- Type: string
The adjustment type, which specifies how
ScalingAdjustment
is interpreted. The valid values areChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
. - Alarms
-
- Type: Array of Alarm structures
The CloudWatch alarms related to the policy.
- AutoScalingGroupName
-
- Type: string
The name of the Auto Scaling group.
- Cooldown
-
- Type: int
The amount of time, in seconds, after a scaling activity completes before any further dynamic scaling activities can start.
- EstimatedInstanceWarmup
-
- Type: int
The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.
- MetricAggregationType
-
- Type: string
The aggregation type for the CloudWatch metrics. The valid values are
Minimum
,Maximum
, andAverage
. - MinAdjustmentMagnitude
-
- Type: int
The minimum number of instances to scale. If the value of
AdjustmentType
isPercentChangeInCapacity
, the scaling policy changes theDesiredCapacity
of the Auto Scaling group by at least this many instances. Otherwise, the error isValidationError
. - MinAdjustmentStep
-
- Type: int
Available for backward compatibility. Use
MinAdjustmentMagnitude
instead. - PolicyARN
-
- Type: string
The Amazon Resource Name (ARN) of the policy.
- PolicyName
-
- Type: string
The name of the scaling policy.
- PolicyType
-
- Type: string
The policy type. The valid values are
SimpleScaling
,StepScaling
, andTargetTrackingScaling
. - ScalingAdjustment
-
- Type: int
The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
- StepAdjustments
-
- Type: Array of StepAdjustment structures
A set of adjustments that enable you to scale based on the size of the alarm breach.
- TargetTrackingConfiguration
-
- Type: TargetTrackingConfiguration structure
A target tracking scaling policy.
ScheduledActionsType
Members
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return. - ScheduledUpdateGroupActions
-
- Type: Array of ScheduledUpdateGroupAction structures
The scheduled actions.
ScheduledUpdateGroupAction
Description
Describes a scheduled scaling action. Used in response to DescribeScheduledActions.
Members
- AutoScalingGroupName
-
- Type: string
The name of the Auto Scaling group.
- DesiredCapacity
-
- Type: int
The number of instances you prefer to maintain in the group.
- EndTime
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The date and time in UTC for the recurring schedule to end. For example,
"2019-06-01T00:00:00Z"
. - MaxSize
-
- Type: int
The maximum number of instances in the Auto Scaling group.
- MinSize
-
- Type: int
The minimum number of instances in the Auto Scaling group.
- Recurrence
-
- Type: string
The recurring schedule for the action, in Unix cron syntax format.
When
StartTime
andEndTime
are specified withRecurrence
, they form the boundaries of when the recurring action starts and stops. - ScheduledActionARN
-
- Type: string
The Amazon Resource Name (ARN) of the scheduled action.
- ScheduledActionName
-
- Type: string
The name of the scheduled action.
- StartTime
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The date and time in UTC for this action to start. For example,
"2019-06-01T00:00:00Z"
. - Time
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
This parameter is no longer used.
ScheduledUpdateGroupActionRequest
Description
Describes one or more scheduled scaling action updates for a specified Auto Scaling group. Used in combination with BatchPutScheduledUpdateGroupAction.
When updating a scheduled scaling action, all optional parameters are left unchanged if not specified.
Members
- DesiredCapacity
-
- Type: int
The number of EC2 instances that should be running in the group.
- EndTime
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The date and time for the recurring schedule to end. Amazon EC2 Auto Scaling does not perform the action after this time.
- MaxSize
-
- Type: int
The maximum number of instances in the Auto Scaling group.
- MinSize
-
- Type: int
The minimum number of instances in the Auto Scaling group.
- Recurrence
-
- Type: string
The recurring schedule for the action, in Unix cron syntax format. This format consists of five fields separated by white spaces: [Minute] [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example,
"30 0 1 1,6,12 *"
). For more information about this format, see Crontab.When
StartTime
andEndTime
are specified withRecurrence
, they form the boundaries of when the recurring action starts and stops. - ScheduledActionName
-
- Required: Yes
- Type: string
The name of the scaling action.
- StartTime
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The date and time for the action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT only and in quotes (for example,
"2019-06-01T00:00:00Z"
).If you specify
Recurrence
andStartTime
, Amazon EC2 Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence.If you try to schedule the action in the past, Amazon EC2 Auto Scaling returns an error message.
ServiceLinkedRoleFailure
SetInstanceProtectionAnswer
Members
StepAdjustment
Description
Describes an adjustment based on the difference between the value of the aggregated CloudWatch metric and the breach threshold that you've defined for the alarm. Used in combination with PutScalingPolicy.
For the following examples, suppose that you have an alarm with a breach threshold of 50:
-
To trigger the adjustment when the metric is greater than or equal to 50 and less than 60, specify a lower bound of 0 and an upper bound of 10.
-
To trigger the adjustment when the metric is greater than 40 and less than or equal to 50, specify a lower bound of -10 and an upper bound of 0.
There are a few rules for the step adjustments for your step policy:
-
The ranges of your step adjustments can't overlap or have a gap.
-
At most, one step adjustment can have a null lower bound. If one step adjustment has a negative lower bound, then there must be a step adjustment with a null lower bound.
-
At most, one step adjustment can have a null upper bound. If one step adjustment has a positive upper bound, then there must be a step adjustment with a null upper bound.
-
The upper and lower bound can't be null in the same step adjustment.
Members
- MetricIntervalLowerBound
-
- Type: double
The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the lower bound is inclusive (the metric must be greater than or equal to the threshold plus the lower bound). Otherwise, it is exclusive (the metric must be greater than the threshold plus the lower bound). A null value indicates negative infinity.
- MetricIntervalUpperBound
-
- Type: double
The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the upper bound is exclusive (the metric must be less than the threshold plus the upper bound). Otherwise, it is inclusive (the metric must be less than or equal to the threshold plus the upper bound). A null value indicates positive infinity.
The upper bound must be greater than the lower bound.
- ScalingAdjustment
-
- Required: Yes
- Type: int
The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
SuspendedProcess
Description
Describes an automatic scaling process that has been suspended. For more information, see ProcessType.
Members
Tag
Description
Describes a tag for an Auto Scaling group.
Members
- Key
-
- Required: Yes
- Type: string
The tag key.
- PropagateAtLaunch
-
- Type: boolean
Determines whether the tag is added to new instances as they are launched in the group.
- ResourceId
-
- Type: string
The name of the group.
- ResourceType
-
- Type: string
The type of resource. The only supported value is
auto-scaling-group
. - Value
-
- Type: string
The tag value.
TagDescription
Description
Describes a tag for an Auto Scaling group.
Members
- Key
-
- Type: string
The tag key.
- PropagateAtLaunch
-
- Type: boolean
Determines whether the tag is added to new instances as they are launched in the group.
- ResourceId
-
- Type: string
The name of the group.
- ResourceType
-
- Type: string
The type of resource. The only supported value is
auto-scaling-group
. - Value
-
- Type: string
The tag value.
TagsType
Members
- NextToken
-
- Type: string
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return. - Tags
-
- Type: Array of TagDescription structures
One or more tags.
TargetTrackingConfiguration
Description
Represents a target tracking scaling policy configuration to use with Amazon EC2 Auto Scaling.
Members
- CustomizedMetricSpecification
-
- Type: CustomizedMetricSpecification structure
A customized metric. You must specify either a predefined metric or a customized metric.
- DisableScaleIn
-
- Type: boolean
Indicates whether scaling in by the target tracking scaling policy is disabled. If scaling in is disabled, the target tracking scaling policy doesn't remove instances from the Auto Scaling group. Otherwise, the target tracking scaling policy can remove instances from the Auto Scaling group. The default is
false
. - PredefinedMetricSpecification
-
- Type: PredefinedMetricSpecification structure
A predefined metric. You must specify either a predefined metric or a customized metric.
- TargetValue
-
- Required: Yes
- Type: double
The target value for the metric.