You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.
Class: Aws::ApplicationAutoScaling::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::ApplicationAutoScaling::Client
- Defined in:
- (unknown)
Overview
An API client for Application Auto Scaling. To construct a client, you need to configure a :region
and :credentials
.
applicationautoscaling = Aws::ApplicationAutoScaling::Client.new(
region: region_name,
credentials: credentials,
# ...
)
See #initialize for a full list of supported configuration options.
Region
You can configure a default region in the following locations:
ENV['AWS_REGION']
Aws.config[:region]
Go here for a list of supported regions.
Credentials
Default credentials are loaded automatically from the following locations:
ENV['AWS_ACCESS_KEY_ID']
andENV['AWS_SECRET_ACCESS_KEY']
Aws.config[:credentials]
- The shared credentials ini file at
~/.aws/credentials
(more information) - From an instance profile when running on EC2
You can also construct a credentials object from one of the following classes:
Alternatively, you configure credentials with :access_key_id
and
:secret_access_key
:
# load credentials from disk
creds = YAML.load(File.read('/path/to/secrets'))
Aws::ApplicationAutoScaling::Client.new(
access_key_id: creds['access_key_id'],
secret_access_key: creds['secret_access_key']
)
Always load your credentials from outside your application. Avoid configuring credentials statically and never commit them to source control.
Instance Attribute Summary
Attributes inherited from Seahorse::Client::Base
Constructor collapse
-
#initialize(options = {}) ⇒ Aws::ApplicationAutoScaling::Client
constructor
Constructs an API client.
API Operations collapse
-
#delete_scaling_policy(options = {}) ⇒ Struct
Deletes the specified scaling policy for an Application Auto Scaling scalable target.
Deleting a step scaling policy deletes the underlying alarm action, but does not delete the CloudWatch alarm associated with the scaling policy, even if it no longer has an associated action.
For more information, see Delete a Step Scaling Policy and Delete a Target Tracking Scaling Policy in the Application Auto Scaling User Guide.
. -
#delete_scheduled_action(options = {}) ⇒ Struct
Deletes the specified scheduled action for an Application Auto Scaling scalable target.
For more information, see Delete a Scheduled Action in the Application Auto Scaling User Guide.
. -
#deregister_scalable_target(options = {}) ⇒ Struct
Deregisters an Application Auto Scaling scalable target when you have finished using it.
-
#describe_scalable_targets(options = {}) ⇒ Types::DescribeScalableTargetsResponse
Gets information about the scalable targets in the specified namespace.
You can filter the results using
.ResourceIds
andScalableDimension
. -
#describe_scaling_activities(options = {}) ⇒ Types::DescribeScalingActivitiesResponse
Provides descriptive information about the scaling activities in the specified namespace from the previous six weeks.
You can filter the results using
.ResourceId
andScalableDimension
. -
#describe_scaling_policies(options = {}) ⇒ Types::DescribeScalingPoliciesResponse
Describes the Application Auto Scaling scaling policies for the specified service namespace.
You can filter the results using
ResourceId
,ScalableDimension
, andPolicyNames
.For more information, see Target Tracking Scaling Policies and Step Scaling Policies in the Application Auto Scaling User Guide.
. -
#describe_scheduled_actions(options = {}) ⇒ Types::DescribeScheduledActionsResponse
Describes the Application Auto Scaling scheduled actions for the specified service namespace.
You can filter the results using the
ResourceId
,ScalableDimension
, andScheduledActionNames
parameters.For more information, see Scheduled Scaling in the Application Auto Scaling User Guide.
. -
#put_scaling_policy(options = {}) ⇒ Types::PutScalingPolicyResponse
Creates or updates a scaling policy for an Application Auto Scaling scalable target.
Each scalable target is identified by a service namespace, resource ID, and scalable dimension.
-
#put_scheduled_action(options = {}) ⇒ Struct
Creates or updates a scheduled action for an Application Auto Scaling scalable target.
Each scalable target is identified by a service namespace, resource ID, and scalable dimension.
-
#register_scalable_target(options = {}) ⇒ Struct
Registers or updates a scalable target.
Instance Method Summary collapse
-
#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean
Waiters polls an API operation until a resource enters a desired state.
-
#waiter_names ⇒ Array<Symbol>
Returns the list of supported waiters.
Methods inherited from Seahorse::Client::Base
add_plugin, api, #build_request, clear_plugins, define, new, #operation, #operation_names, plugins, remove_plugin, set_api, set_plugins
Methods included from Seahorse::Client::HandlerBuilder
#handle, #handle_request, #handle_response
Constructor Details
#initialize(options = {}) ⇒ Aws::ApplicationAutoScaling::Client
Constructs an API client.
Options Hash (options):
-
:access_key_id
(String)
—
Used to set credentials statically. See Plugins::RequestSigner for more details.
-
:active_endpoint_cache
(Boolean)
—
When set to
true
, a thread polling for endpoints will be running in the background every 60 secs (default). Defaults tofalse
. See Plugins::EndpointDiscovery for more details. -
:convert_params
(Boolean)
— default:
true
—
When
true
, an attempt is made to coerce request parameters into the required types. See Plugins::ParamConverter for more details. -
:credentials
(required, Credentials)
—
Your AWS credentials. The following locations will be searched in order for credentials:
:access_key_id
,:secret_access_key
, and:session_token
options- ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
HOME/.aws/credentials
shared credentials file- EC2 instance profile credentials See Plugins::RequestSigner for more details.
-
:disable_host_prefix_injection
(Boolean)
—
Set to true to disable SDK automatically adding host prefix to default service endpoint when available. See Plugins::EndpointPattern for more details.
-
:endpoint
(String)
—
A default endpoint is constructed from the
:region
. See Plugins::RegionalEndpoint for more details. -
:endpoint_cache_max_entries
(Integer)
—
Used for the maximum size limit of the LRU cache storing endpoints data for endpoint discovery enabled operations. Defaults to 1000. See Plugins::EndpointDiscovery for more details.
-
:endpoint_cache_max_threads
(Integer)
—
Used for the maximum threads in use for polling endpoints to be cached, defaults to 10. See Plugins::EndpointDiscovery for more details.
-
:endpoint_cache_poll_interval
(Integer)
—
When :endpoint_discovery and :active_endpoint_cache is enabled, Use this option to config the time interval in seconds for making requests fetching endpoints information. Defaults to 60 sec. See Plugins::EndpointDiscovery for more details.
-
:endpoint_discovery
(Boolean)
—
When set to
true
, endpoint discovery will be enabled for operations when available. Defaults tofalse
. See Plugins::EndpointDiscovery for more details. -
:http_continue_timeout
(Float)
— default:
1
—
See Seahorse::Client::Plugins::NetHttp for more details.
-
:http_idle_timeout
(Integer)
— default:
5
—
See Seahorse::Client::Plugins::NetHttp for more details.
-
:http_open_timeout
(Integer)
— default:
15
—
See Seahorse::Client::Plugins::NetHttp for more details.
-
:http_proxy
(String)
—
See Seahorse::Client::Plugins::NetHttp for more details.
-
:http_read_timeout
(Integer)
— default:
60
—
See Seahorse::Client::Plugins::NetHttp for more details.
-
:http_wire_trace
(Boolean)
— default:
false
—
See Seahorse::Client::Plugins::NetHttp for more details.
-
:log_level
(Symbol)
— default:
:info
—
The log level to send messages to the logger at. See Plugins::Logging for more details.
-
:log_formatter
(Logging::LogFormatter)
—
The log formatter. Defaults to Seahorse::Client::Logging::Formatter.default. See Plugins::Logging for more details.
-
:logger
(Logger)
— default:
nil
—
The Logger instance to send log messages to. If this option is not set, logging will be disabled. See Plugins::Logging for more details.
-
:profile
(String)
—
Used when loading credentials from the shared credentials file at HOME/.aws/credentials. When not specified, 'default' is used. See Plugins::RequestSigner for more details.
-
:raise_response_errors
(Boolean)
— default:
true
—
When
true
, response errors are raised. See Seahorse::Client::Plugins::RaiseResponseErrors for more details. -
:region
(required, String)
—
The AWS region to connect to. The region is used to construct the client endpoint. Defaults to
ENV['AWS_REGION']
. Also checksAMAZON_REGION
andAWS_DEFAULT_REGION
. See Plugins::RegionalEndpoint for more details. -
:retry_limit
(Integer)
— default:
3
—
The maximum number of times to retry failed requests. Only ~ 500 level server errors and certain ~ 400 level client errors are retried. Generally, these are throttling errors, data checksum errors, networking errors, timeout errors and auth errors from expired credentials. See Plugins::RetryErrors for more details.
-
:secret_access_key
(String)
—
Used to set credentials statically. See Plugins::RequestSigner for more details.
-
:session_token
(String)
—
Used to set credentials statically. See Plugins::RequestSigner for more details.
-
:simple_json
(Boolean)
— default:
false
—
Disables request parameter conversion, validation, and formatting. Also disable response data type conversions. This option is useful when you want to ensure the highest level of performance by avoiding overhead of walking request parameters and response data structures.
When
:simple_json
is enabled, the request parameters hash must be formatted exactly as the DynamoDB API expects. See Plugins::Protocols::JsonRpc for more details. -
:ssl_ca_bundle
(String)
—
See Seahorse::Client::Plugins::NetHttp for more details.
-
:ssl_ca_directory
(String)
—
See Seahorse::Client::Plugins::NetHttp for more details.
-
:ssl_ca_store
(String)
—
See Seahorse::Client::Plugins::NetHttp for more details.
-
:ssl_verify_peer
(Boolean)
— default:
true
—
See Seahorse::Client::Plugins::NetHttp for more details.
-
:stub_responses
(Boolean)
— default:
false
—
Causes the client to return stubbed responses. By default fake responses are generated and returned. You can specify the response data to return or errors to raise by calling ClientStubs#stub_responses. See ClientStubs for more information.
Please note When response stubbing is enabled, no HTTP requests are made, and retries are disabled. See Plugins::StubResponses for more details.
-
:validate_params
(Boolean)
— default:
true
—
When
true
, request parameters are validated before sending the request. See Plugins::ParamValidator for more details.
Instance Method Details
#delete_scaling_policy(options = {}) ⇒ Struct
Deletes the specified scaling policy for an Application Auto Scaling scalable target.
Deleting a step scaling policy deletes the underlying alarm action, but does not delete the CloudWatch alarm associated with the scaling policy, even if it no longer has an associated action.
For more information, see Delete a Step Scaling Policy and Delete a Target Tracking Scaling Policy in the Application Auto Scaling User Guide.
Examples:
Example: To delete a scaling policy
# This example deletes a scaling policy for the Amazon ECS service called web-app, which is running in the default cluster.
resp = client.delete_scaling_policy({
policy_name: "web-app-cpu-lt-25",
resource_id: "service/default/web-app",
scalable_dimension: "ecs:service:DesiredCount",
service_namespace: "ecs",
})
# resp.to_h outputs the following:
{
}
Request syntax with placeholder values
resp = client.delete_scaling_policy({
policy_name: "ResourceIdMaxLen1600", # required
service_namespace: "ecs", # required, accepts ecs, elasticmapreduce, ec2, appstream, dynamodb, rds, sagemaker, custom-resource, comprehend, lambda, cassandra, kafka
resource_id: "ResourceIdMaxLen1600", # required
scalable_dimension: "ecs:service:DesiredCount", # required, accepts ecs:service:DesiredCount, ec2:spot-fleet-request:TargetCapacity, elasticmapreduce:instancegroup:InstanceCount, appstream:fleet:DesiredCapacity, dynamodb:table:ReadCapacityUnits, dynamodb:table:WriteCapacityUnits, dynamodb:index:ReadCapacityUnits, dynamodb:index:WriteCapacityUnits, rds:cluster:ReadReplicaCount, sagemaker:variant:DesiredInstanceCount, custom-resource:ResourceType:Property, comprehend:document-classifier-endpoint:DesiredInferenceUnits, comprehend:entity-recognizer-endpoint:DesiredInferenceUnits, lambda:function:ProvisionedConcurrency, cassandra:table:ReadCapacityUnits, cassandra:table:WriteCapacityUnits, kafka:broker-storage:VolumeSize
})
Options Hash (options):
-
:policy_name
(required, String)
—
The name of the scaling policy.
-
:service_namespace
(required, String)
—
The namespace of the AWS service that provides the resource. For a resource provided by your own application or service, use
custom-resource
instead. -
:resource_id
(required, String)
—
The identifier of the resource associated with the scalable target. This string consists of the resource type and unique identifier.
ECS service - The resource type is
service
and the unique identifier is the cluster name and service name. Example:service/default/sample-webapp
.Spot Fleet request - The resource type is
spot-fleet-request
and the unique identifier is the Spot Fleet request ID. Example:spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE
.EMR cluster - The resource type is
instancegroup
and the unique identifier is the cluster ID and instance group ID. Example:instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0
.AppStream 2.0 fleet - The resource type is
fleet
and the unique identifier is the fleet name. Example:fleet/sample-fleet
.DynamoDB table - The resource type is
table
and the unique identifier is the table name. Example:table/my-table
.DynamoDB global secondary index - The resource type is
index
and the unique identifier is the index name. Example:table/my-table/index/my-table-index
.Aurora DB cluster - The resource type is
cluster
and the unique identifier is the cluster name. Example:cluster:my-db-cluster
.Amazon SageMaker endpoint variant - The resource type is
variant
and the unique identifier is the resource ID. Example:endpoint/my-end-point/variant/KMeansClustering
.Custom resources are not supported with a resource type. This parameter must specify the
OutputValue
from the CloudFormation template stack used to access the resources. The unique identifier is defined by the service provider. More information is available in our GitHub repository.Amazon Comprehend document classification endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:document-classifier-endpoint/EXAMPLE
.Amazon Comprehend entity recognizer endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:entity-recognizer-endpoint/EXAMPLE
.Lambda provisioned concurrency - The resource type is
function
and the unique identifier is the function name with a function version or alias name suffix that is not$LATEST
. Example:function:my-function:prod
orfunction:my-function:1
.Amazon Keyspaces table - The resource type is
table
and the unique identifier is the table name. Example:keyspace/mykeyspace/table/mytable
.Amazon MSK cluster - The resource type and unique identifier are specified using the cluster ARN. Example:
arn:aws:kafka:us-east-1:123456789012:cluster/demo-cluster-1/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5
.
-
:scalable_dimension
(required, String)
—
The scalable dimension. This string consists of the service namespace, resource type, and scaling property.
ecs:service:DesiredCount
- The desired task count of an ECS service.ec2:spot-fleet-request:TargetCapacity
- The target capacity of a Spot Fleet request.elasticmapreduce:instancegroup:InstanceCount
- The instance count of an EMR Instance Group.appstream:fleet:DesiredCapacity
- The desired capacity of an AppStream 2.0 fleet.dynamodb:table:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB table.dynamodb:table:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB table.dynamodb:index:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB global secondary index.dynamodb:index:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB global secondary index.rds:cluster:ReadReplicaCount
- The count of Aurora Replicas in an Aurora DB cluster. Available for Aurora MySQL-compatible edition and Aurora PostgreSQL-compatible edition.sagemaker:variant:DesiredInstanceCount
- The number of EC2 instances for an Amazon SageMaker model endpoint variant.custom-resource:ResourceType:Property
- The scalable dimension for a custom resource provided by your own application or service.comprehend:document-classifier-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend document classification endpoint.comprehend:entity-recognizer-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend entity recognizer endpoint.lambda:function:ProvisionedConcurrency
- The provisioned concurrency for a Lambda function.cassandra:table:ReadCapacityUnits
- The provisioned read capacity for an Amazon Keyspaces table.cassandra:table:WriteCapacityUnits
- The provisioned write capacity for an Amazon Keyspaces table.kafka:broker-storage:VolumeSize
- The provisioned volume size (in GiB) for brokers in an Amazon MSK cluster.
Returns:
-
(Struct)
—
Returns an empty response.
See Also:
#delete_scheduled_action(options = {}) ⇒ Struct
Deletes the specified scheduled action for an Application Auto Scaling scalable target.
For more information, see Delete a Scheduled Action in the Application Auto Scaling User Guide.
Examples:
Request syntax with placeholder values
resp = client.delete_scheduled_action({
service_namespace: "ecs", # required, accepts ecs, elasticmapreduce, ec2, appstream, dynamodb, rds, sagemaker, custom-resource, comprehend, lambda, cassandra, kafka
scheduled_action_name: "ResourceIdMaxLen1600", # required
resource_id: "ResourceIdMaxLen1600", # required
scalable_dimension: "ecs:service:DesiredCount", # required, accepts ecs:service:DesiredCount, ec2:spot-fleet-request:TargetCapacity, elasticmapreduce:instancegroup:InstanceCount, appstream:fleet:DesiredCapacity, dynamodb:table:ReadCapacityUnits, dynamodb:table:WriteCapacityUnits, dynamodb:index:ReadCapacityUnits, dynamodb:index:WriteCapacityUnits, rds:cluster:ReadReplicaCount, sagemaker:variant:DesiredInstanceCount, custom-resource:ResourceType:Property, comprehend:document-classifier-endpoint:DesiredInferenceUnits, comprehend:entity-recognizer-endpoint:DesiredInferenceUnits, lambda:function:ProvisionedConcurrency, cassandra:table:ReadCapacityUnits, cassandra:table:WriteCapacityUnits, kafka:broker-storage:VolumeSize
})
Options Hash (options):
-
:service_namespace
(required, String)
—
The namespace of the AWS service that provides the resource. For a resource provided by your own application or service, use
custom-resource
instead. -
:scheduled_action_name
(required, String)
—
The name of the scheduled action.
-
:resource_id
(required, String)
—
The identifier of the resource associated with the scheduled action. This string consists of the resource type and unique identifier.
ECS service - The resource type is
service
and the unique identifier is the cluster name and service name. Example:service/default/sample-webapp
.Spot Fleet request - The resource type is
spot-fleet-request
and the unique identifier is the Spot Fleet request ID. Example:spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE
.EMR cluster - The resource type is
instancegroup
and the unique identifier is the cluster ID and instance group ID. Example:instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0
.AppStream 2.0 fleet - The resource type is
fleet
and the unique identifier is the fleet name. Example:fleet/sample-fleet
.DynamoDB table - The resource type is
table
and the unique identifier is the table name. Example:table/my-table
.DynamoDB global secondary index - The resource type is
index
and the unique identifier is the index name. Example:table/my-table/index/my-table-index
.Aurora DB cluster - The resource type is
cluster
and the unique identifier is the cluster name. Example:cluster:my-db-cluster
.Amazon SageMaker endpoint variant - The resource type is
variant
and the unique identifier is the resource ID. Example:endpoint/my-end-point/variant/KMeansClustering
.Custom resources are not supported with a resource type. This parameter must specify the
OutputValue
from the CloudFormation template stack used to access the resources. The unique identifier is defined by the service provider. More information is available in our GitHub repository.Amazon Comprehend document classification endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:document-classifier-endpoint/EXAMPLE
.Amazon Comprehend entity recognizer endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:entity-recognizer-endpoint/EXAMPLE
.Lambda provisioned concurrency - The resource type is
function
and the unique identifier is the function name with a function version or alias name suffix that is not$LATEST
. Example:function:my-function:prod
orfunction:my-function:1
.Amazon Keyspaces table - The resource type is
table
and the unique identifier is the table name. Example:keyspace/mykeyspace/table/mytable
.Amazon MSK cluster - The resource type and unique identifier are specified using the cluster ARN. Example:
arn:aws:kafka:us-east-1:123456789012:cluster/demo-cluster-1/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5
.
-
:scalable_dimension
(required, String)
—
The scalable dimension. This string consists of the service namespace, resource type, and scaling property.
ecs:service:DesiredCount
- The desired task count of an ECS service.ec2:spot-fleet-request:TargetCapacity
- The target capacity of a Spot Fleet request.elasticmapreduce:instancegroup:InstanceCount
- The instance count of an EMR Instance Group.appstream:fleet:DesiredCapacity
- The desired capacity of an AppStream 2.0 fleet.dynamodb:table:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB table.dynamodb:table:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB table.dynamodb:index:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB global secondary index.dynamodb:index:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB global secondary index.rds:cluster:ReadReplicaCount
- The count of Aurora Replicas in an Aurora DB cluster. Available for Aurora MySQL-compatible edition and Aurora PostgreSQL-compatible edition.sagemaker:variant:DesiredInstanceCount
- The number of EC2 instances for an Amazon SageMaker model endpoint variant.custom-resource:ResourceType:Property
- The scalable dimension for a custom resource provided by your own application or service.comprehend:document-classifier-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend document classification endpoint.comprehend:entity-recognizer-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend entity recognizer endpoint.lambda:function:ProvisionedConcurrency
- The provisioned concurrency for a Lambda function.cassandra:table:ReadCapacityUnits
- The provisioned read capacity for an Amazon Keyspaces table.cassandra:table:WriteCapacityUnits
- The provisioned write capacity for an Amazon Keyspaces table.kafka:broker-storage:VolumeSize
- The provisioned volume size (in GiB) for brokers in an Amazon MSK cluster.
Returns:
-
(Struct)
—
Returns an empty response.
See Also:
#deregister_scalable_target(options = {}) ⇒ Struct
Deregisters an Application Auto Scaling scalable target when you have finished using it. To see which resources have been registered, use DescribeScalableTargets.
Deregistering a scalable target deletes the scaling policies and the scheduled actions that are associated with it.
Examples:
Example: To deregister a scalable target
# This example deregisters a scalable target for an Amazon ECS service called web-app that is running in the default cluster.
resp = client.deregister_scalable_target({
resource_id: "service/default/web-app",
scalable_dimension: "ecs:service:DesiredCount",
service_namespace: "ecs",
})
# resp.to_h outputs the following:
{
}
Request syntax with placeholder values
resp = client.deregister_scalable_target({
service_namespace: "ecs", # required, accepts ecs, elasticmapreduce, ec2, appstream, dynamodb, rds, sagemaker, custom-resource, comprehend, lambda, cassandra, kafka
resource_id: "ResourceIdMaxLen1600", # required
scalable_dimension: "ecs:service:DesiredCount", # required, accepts ecs:service:DesiredCount, ec2:spot-fleet-request:TargetCapacity, elasticmapreduce:instancegroup:InstanceCount, appstream:fleet:DesiredCapacity, dynamodb:table:ReadCapacityUnits, dynamodb:table:WriteCapacityUnits, dynamodb:index:ReadCapacityUnits, dynamodb:index:WriteCapacityUnits, rds:cluster:ReadReplicaCount, sagemaker:variant:DesiredInstanceCount, custom-resource:ResourceType:Property, comprehend:document-classifier-endpoint:DesiredInferenceUnits, comprehend:entity-recognizer-endpoint:DesiredInferenceUnits, lambda:function:ProvisionedConcurrency, cassandra:table:ReadCapacityUnits, cassandra:table:WriteCapacityUnits, kafka:broker-storage:VolumeSize
})
Options Hash (options):
-
:service_namespace
(required, String)
—
The namespace of the AWS service that provides the resource. For a resource provided by your own application or service, use
custom-resource
instead. -
:resource_id
(required, String)
—
The identifier of the resource associated with the scalable target. This string consists of the resource type and unique identifier.
ECS service - The resource type is
service
and the unique identifier is the cluster name and service name. Example:service/default/sample-webapp
.Spot Fleet request - The resource type is
spot-fleet-request
and the unique identifier is the Spot Fleet request ID. Example:spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE
.EMR cluster - The resource type is
instancegroup
and the unique identifier is the cluster ID and instance group ID. Example:instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0
.AppStream 2.0 fleet - The resource type is
fleet
and the unique identifier is the fleet name. Example:fleet/sample-fleet
.DynamoDB table - The resource type is
table
and the unique identifier is the table name. Example:table/my-table
.DynamoDB global secondary index - The resource type is
index
and the unique identifier is the index name. Example:table/my-table/index/my-table-index
.Aurora DB cluster - The resource type is
cluster
and the unique identifier is the cluster name. Example:cluster:my-db-cluster
.Amazon SageMaker endpoint variant - The resource type is
variant
and the unique identifier is the resource ID. Example:endpoint/my-end-point/variant/KMeansClustering
.Custom resources are not supported with a resource type. This parameter must specify the
OutputValue
from the CloudFormation template stack used to access the resources. The unique identifier is defined by the service provider. More information is available in our GitHub repository.Amazon Comprehend document classification endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:document-classifier-endpoint/EXAMPLE
.Amazon Comprehend entity recognizer endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:entity-recognizer-endpoint/EXAMPLE
.Lambda provisioned concurrency - The resource type is
function
and the unique identifier is the function name with a function version or alias name suffix that is not$LATEST
. Example:function:my-function:prod
orfunction:my-function:1
.Amazon Keyspaces table - The resource type is
table
and the unique identifier is the table name. Example:keyspace/mykeyspace/table/mytable
.Amazon MSK cluster - The resource type and unique identifier are specified using the cluster ARN. Example:
arn:aws:kafka:us-east-1:123456789012:cluster/demo-cluster-1/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5
.
-
:scalable_dimension
(required, String)
—
The scalable dimension associated with the scalable target. This string consists of the service namespace, resource type, and scaling property.
ecs:service:DesiredCount
- The desired task count of an ECS service.ec2:spot-fleet-request:TargetCapacity
- The target capacity of a Spot Fleet request.elasticmapreduce:instancegroup:InstanceCount
- The instance count of an EMR Instance Group.appstream:fleet:DesiredCapacity
- The desired capacity of an AppStream 2.0 fleet.dynamodb:table:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB table.dynamodb:table:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB table.dynamodb:index:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB global secondary index.dynamodb:index:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB global secondary index.rds:cluster:ReadReplicaCount
- The count of Aurora Replicas in an Aurora DB cluster. Available for Aurora MySQL-compatible edition and Aurora PostgreSQL-compatible edition.sagemaker:variant:DesiredInstanceCount
- The number of EC2 instances for an Amazon SageMaker model endpoint variant.custom-resource:ResourceType:Property
- The scalable dimension for a custom resource provided by your own application or service.comprehend:document-classifier-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend document classification endpoint.comprehend:entity-recognizer-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend entity recognizer endpoint.lambda:function:ProvisionedConcurrency
- The provisioned concurrency for a Lambda function.cassandra:table:ReadCapacityUnits
- The provisioned read capacity for an Amazon Keyspaces table.cassandra:table:WriteCapacityUnits
- The provisioned write capacity for an Amazon Keyspaces table.kafka:broker-storage:VolumeSize
- The provisioned volume size (in GiB) for brokers in an Amazon MSK cluster.
Returns:
-
(Struct)
—
Returns an empty response.
See Also:
#describe_scalable_targets(options = {}) ⇒ Types::DescribeScalableTargetsResponse
Gets information about the scalable targets in the specified namespace.
You can filter the results using ResourceIds
and ScalableDimension
.
Examples:
Example: To describe scalable targets
# This example describes the scalable targets for the ECS service namespace.
resp = client.describe_scalable_targets({
service_namespace: "ecs",
})
# resp.to_h outputs the following:
{
scalable_targets: [
{
creation_time: Time.parse("2019-05-06T11:21:46.199Z"),
max_capacity: 10,
min_capacity: 1,
resource_id: "service/default/web-app",
role_arn: "arn:aws:iam::012345678910:role/aws-service-role/ecs.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_ECSService",
scalable_dimension: "ecs:service:DesiredCount",
service_namespace: "ecs",
suspended_state: {
dynamic_scaling_in_suspended: false,
dynamic_scaling_out_suspended: false,
scheduled_scaling_suspended: false,
},
},
],
}
Request syntax with placeholder values
resp = client.describe_scalable_targets({
service_namespace: "ecs", # required, accepts ecs, elasticmapreduce, ec2, appstream, dynamodb, rds, sagemaker, custom-resource, comprehend, lambda, cassandra, kafka
resource_ids: ["ResourceIdMaxLen1600"],
scalable_dimension: "ecs:service:DesiredCount", # accepts ecs:service:DesiredCount, ec2:spot-fleet-request:TargetCapacity, elasticmapreduce:instancegroup:InstanceCount, appstream:fleet:DesiredCapacity, dynamodb:table:ReadCapacityUnits, dynamodb:table:WriteCapacityUnits, dynamodb:index:ReadCapacityUnits, dynamodb:index:WriteCapacityUnits, rds:cluster:ReadReplicaCount, sagemaker:variant:DesiredInstanceCount, custom-resource:ResourceType:Property, comprehend:document-classifier-endpoint:DesiredInferenceUnits, comprehend:entity-recognizer-endpoint:DesiredInferenceUnits, lambda:function:ProvisionedConcurrency, cassandra:table:ReadCapacityUnits, cassandra:table:WriteCapacityUnits, kafka:broker-storage:VolumeSize
max_results: 1,
next_token: "XmlString",
})
Response structure
resp.scalable_targets #=> Array
resp.scalable_targets[0].service_namespace #=> String, one of "ecs", "elasticmapreduce", "ec2", "appstream", "dynamodb", "rds", "sagemaker", "custom-resource", "comprehend", "lambda", "cassandra", "kafka"
resp.scalable_targets[0].resource_id #=> String
resp.scalable_targets[0].scalable_dimension #=> String, one of "ecs:service:DesiredCount", "ec2:spot-fleet-request:TargetCapacity", "elasticmapreduce:instancegroup:InstanceCount", "appstream:fleet:DesiredCapacity", "dynamodb:table:ReadCapacityUnits", "dynamodb:table:WriteCapacityUnits", "dynamodb:index:ReadCapacityUnits", "dynamodb:index:WriteCapacityUnits", "rds:cluster:ReadReplicaCount", "sagemaker:variant:DesiredInstanceCount", "custom-resource:ResourceType:Property", "comprehend:document-classifier-endpoint:DesiredInferenceUnits", "comprehend:entity-recognizer-endpoint:DesiredInferenceUnits", "lambda:function:ProvisionedConcurrency", "cassandra:table:ReadCapacityUnits", "cassandra:table:WriteCapacityUnits", "kafka:broker-storage:VolumeSize"
resp.scalable_targets[0].min_capacity #=> Integer
resp.scalable_targets[0].max_capacity #=> Integer
resp.scalable_targets[0].role_arn #=> String
resp.scalable_targets[0].creation_time #=> Time
resp.scalable_targets[0].suspended_state.dynamic_scaling_in_suspended #=> true/false
resp.scalable_targets[0].suspended_state.dynamic_scaling_out_suspended #=> true/false
resp.scalable_targets[0].suspended_state.scheduled_scaling_suspended #=> true/false
resp.next_token #=> String
Options Hash (options):
-
:service_namespace
(required, String)
—
The namespace of the AWS service that provides the resource. For a resource provided by your own application or service, use
custom-resource
instead. -
:resource_ids
(Array<String>)
—
The identifier of the resource associated with the scalable target. This string consists of the resource type and unique identifier. If you specify a scalable dimension, you must also specify a resource ID.
ECS service - The resource type is
service
and the unique identifier is the cluster name and service name. Example:service/default/sample-webapp
.Spot Fleet request - The resource type is
spot-fleet-request
and the unique identifier is the Spot Fleet request ID. Example:spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE
.EMR cluster - The resource type is
instancegroup
and the unique identifier is the cluster ID and instance group ID. Example:instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0
.AppStream 2.0 fleet - The resource type is
fleet
and the unique identifier is the fleet name. Example:fleet/sample-fleet
.DynamoDB table - The resource type is
table
and the unique identifier is the table name. Example:table/my-table
.DynamoDB global secondary index - The resource type is
index
and the unique identifier is the index name. Example:table/my-table/index/my-table-index
.Aurora DB cluster - The resource type is
cluster
and the unique identifier is the cluster name. Example:cluster:my-db-cluster
.Amazon SageMaker endpoint variant - The resource type is
variant
and the unique identifier is the resource ID. Example:endpoint/my-end-point/variant/KMeansClustering
.Custom resources are not supported with a resource type. This parameter must specify the
OutputValue
from the CloudFormation template stack used to access the resources. The unique identifier is defined by the service provider. More information is available in our GitHub repository.Amazon Comprehend document classification endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:document-classifier-endpoint/EXAMPLE
.Amazon Comprehend entity recognizer endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:entity-recognizer-endpoint/EXAMPLE
.Lambda provisioned concurrency - The resource type is
function
and the unique identifier is the function name with a function version or alias name suffix that is not$LATEST
. Example:function:my-function:prod
orfunction:my-function:1
.Amazon Keyspaces table - The resource type is
table
and the unique identifier is the table name. Example:keyspace/mykeyspace/table/mytable
.Amazon MSK cluster - The resource type and unique identifier are specified using the cluster ARN. Example:
arn:aws:kafka:us-east-1:123456789012:cluster/demo-cluster-1/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5
.
-
:scalable_dimension
(String)
—
The scalable dimension associated with the scalable target. This string consists of the service namespace, resource type, and scaling property. If you specify a scalable dimension, you must also specify a resource ID.
ecs:service:DesiredCount
- The desired task count of an ECS service.ec2:spot-fleet-request:TargetCapacity
- The target capacity of a Spot Fleet request.elasticmapreduce:instancegroup:InstanceCount
- The instance count of an EMR Instance Group.appstream:fleet:DesiredCapacity
- The desired capacity of an AppStream 2.0 fleet.dynamodb:table:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB table.dynamodb:table:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB table.dynamodb:index:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB global secondary index.dynamodb:index:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB global secondary index.rds:cluster:ReadReplicaCount
- The count of Aurora Replicas in an Aurora DB cluster. Available for Aurora MySQL-compatible edition and Aurora PostgreSQL-compatible edition.sagemaker:variant:DesiredInstanceCount
- The number of EC2 instances for an Amazon SageMaker model endpoint variant.custom-resource:ResourceType:Property
- The scalable dimension for a custom resource provided by your own application or service.comprehend:document-classifier-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend document classification endpoint.comprehend:entity-recognizer-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend entity recognizer endpoint.lambda:function:ProvisionedConcurrency
- The provisioned concurrency for a Lambda function.cassandra:table:ReadCapacityUnits
- The provisioned read capacity for an Amazon Keyspaces table.cassandra:table:WriteCapacityUnits
- The provisioned write capacity for an Amazon Keyspaces table.kafka:broker-storage:VolumeSize
- The provisioned volume size (in GiB) for brokers in an Amazon MSK cluster.
-
:max_results
(Integer)
—
The maximum number of scalable targets. This value can be between 1 and 50. The default value is 50.
If this parameter is used, the operation returns up to
MaxResults
results at a time, along with aNextToken
value. To get the next set of results, include theNextToken
value in a subsequent call. If this parameter is not used, the operation returns up to 50 results and aNextToken
value, if applicable. -
:next_token
(String)
—
The token for the next set of results.
Returns:
-
(Types::DescribeScalableTargetsResponse)
—
Returns a response object which responds to the following methods:
- #scalable_targets => Array<Types::ScalableTarget>
- #next_token => String
See Also:
#describe_scaling_activities(options = {}) ⇒ Types::DescribeScalingActivitiesResponse
Provides descriptive information about the scaling activities in the specified namespace from the previous six weeks.
You can filter the results using ResourceId
and ScalableDimension
.
Examples:
Example: To describe scaling activities for a scalable target
# This example describes the scaling activities for an Amazon ECS service called web-app that is running in the default cluster.
resp = client.describe_scaling_activities({
resource_id: "service/default/web-app",
scalable_dimension: "ecs:service:DesiredCount",
service_namespace: "ecs",
})
# resp.to_h outputs the following:
{
scaling_activities: [
{
activity_id: "e6c5f7d1-dbbb-4a3f-89b2-51f33e766399",
cause: "monitor alarm web-app-cpu-lt-25 in state ALARM triggered policy web-app-cpu-lt-25",
description: "Setting desired count to 1.",
end_time: Time.parse("2019-05-06T16:04:32.111Z"),
resource_id: "service/default/web-app",
scalable_dimension: "ecs:service:DesiredCount",
service_namespace: "ecs",
start_time: Time.parse("2019-05-06T16:03:58.171Z"),
status_code: "Successful",
status_message: "Successfully set desired count to 1. Change successfully fulfilled by ecs.",
},
],
}
Request syntax with placeholder values
resp = client.describe_scaling_activities({
service_namespace: "ecs", # required, accepts ecs, elasticmapreduce, ec2, appstream, dynamodb, rds, sagemaker, custom-resource, comprehend, lambda, cassandra, kafka
resource_id: "ResourceIdMaxLen1600",
scalable_dimension: "ecs:service:DesiredCount", # accepts ecs:service:DesiredCount, ec2:spot-fleet-request:TargetCapacity, elasticmapreduce:instancegroup:InstanceCount, appstream:fleet:DesiredCapacity, dynamodb:table:ReadCapacityUnits, dynamodb:table:WriteCapacityUnits, dynamodb:index:ReadCapacityUnits, dynamodb:index:WriteCapacityUnits, rds:cluster:ReadReplicaCount, sagemaker:variant:DesiredInstanceCount, custom-resource:ResourceType:Property, comprehend:document-classifier-endpoint:DesiredInferenceUnits, comprehend:entity-recognizer-endpoint:DesiredInferenceUnits, lambda:function:ProvisionedConcurrency, cassandra:table:ReadCapacityUnits, cassandra:table:WriteCapacityUnits, kafka:broker-storage:VolumeSize
max_results: 1,
next_token: "XmlString",
})
Response structure
resp.scaling_activities #=> Array
resp.scaling_activities[0].activity_id #=> String
resp.scaling_activities[0].service_namespace #=> String, one of "ecs", "elasticmapreduce", "ec2", "appstream", "dynamodb", "rds", "sagemaker", "custom-resource", "comprehend", "lambda", "cassandra", "kafka"
resp.scaling_activities[0].resource_id #=> String
resp.scaling_activities[0].scalable_dimension #=> String, one of "ecs:service:DesiredCount", "ec2:spot-fleet-request:TargetCapacity", "elasticmapreduce:instancegroup:InstanceCount", "appstream:fleet:DesiredCapacity", "dynamodb:table:ReadCapacityUnits", "dynamodb:table:WriteCapacityUnits", "dynamodb:index:ReadCapacityUnits", "dynamodb:index:WriteCapacityUnits", "rds:cluster:ReadReplicaCount", "sagemaker:variant:DesiredInstanceCount", "custom-resource:ResourceType:Property", "comprehend:document-classifier-endpoint:DesiredInferenceUnits", "comprehend:entity-recognizer-endpoint:DesiredInferenceUnits", "lambda:function:ProvisionedConcurrency", "cassandra:table:ReadCapacityUnits", "cassandra:table:WriteCapacityUnits", "kafka:broker-storage:VolumeSize"
resp.scaling_activities[0].description #=> String
resp.scaling_activities[0].cause #=> String
resp.scaling_activities[0].start_time #=> Time
resp.scaling_activities[0].end_time #=> Time
resp.scaling_activities[0].status_code #=> String, one of "Pending", "InProgress", "Successful", "Overridden", "Unfulfilled", "Failed"
resp.scaling_activities[0].status_message #=> String
resp.scaling_activities[0].details #=> String
resp.next_token #=> String
Options Hash (options):
-
:service_namespace
(required, String)
—
The namespace of the AWS service that provides the resource. For a resource provided by your own application or service, use
custom-resource
instead. -
:resource_id
(String)
—
The identifier of the resource associated with the scaling activity. This string consists of the resource type and unique identifier. If you specify a scalable dimension, you must also specify a resource ID.
ECS service - The resource type is
service
and the unique identifier is the cluster name and service name. Example:service/default/sample-webapp
.Spot Fleet request - The resource type is
spot-fleet-request
and the unique identifier is the Spot Fleet request ID. Example:spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE
.EMR cluster - The resource type is
instancegroup
and the unique identifier is the cluster ID and instance group ID. Example:instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0
.AppStream 2.0 fleet - The resource type is
fleet
and the unique identifier is the fleet name. Example:fleet/sample-fleet
.DynamoDB table - The resource type is
table
and the unique identifier is the table name. Example:table/my-table
.DynamoDB global secondary index - The resource type is
index
and the unique identifier is the index name. Example:table/my-table/index/my-table-index
.Aurora DB cluster - The resource type is
cluster
and the unique identifier is the cluster name. Example:cluster:my-db-cluster
.Amazon SageMaker endpoint variant - The resource type is
variant
and the unique identifier is the resource ID. Example:endpoint/my-end-point/variant/KMeansClustering
.Custom resources are not supported with a resource type. This parameter must specify the
OutputValue
from the CloudFormation template stack used to access the resources. The unique identifier is defined by the service provider. More information is available in our GitHub repository.Amazon Comprehend document classification endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:document-classifier-endpoint/EXAMPLE
.Amazon Comprehend entity recognizer endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:entity-recognizer-endpoint/EXAMPLE
.Lambda provisioned concurrency - The resource type is
function
and the unique identifier is the function name with a function version or alias name suffix that is not$LATEST
. Example:function:my-function:prod
orfunction:my-function:1
.Amazon Keyspaces table - The resource type is
table
and the unique identifier is the table name. Example:keyspace/mykeyspace/table/mytable
.Amazon MSK cluster - The resource type and unique identifier are specified using the cluster ARN. Example:
arn:aws:kafka:us-east-1:123456789012:cluster/demo-cluster-1/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5
.
-
:scalable_dimension
(String)
—
The scalable dimension. This string consists of the service namespace, resource type, and scaling property. If you specify a scalable dimension, you must also specify a resource ID.
ecs:service:DesiredCount
- The desired task count of an ECS service.ec2:spot-fleet-request:TargetCapacity
- The target capacity of a Spot Fleet request.elasticmapreduce:instancegroup:InstanceCount
- The instance count of an EMR Instance Group.appstream:fleet:DesiredCapacity
- The desired capacity of an AppStream 2.0 fleet.dynamodb:table:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB table.dynamodb:table:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB table.dynamodb:index:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB global secondary index.dynamodb:index:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB global secondary index.rds:cluster:ReadReplicaCount
- The count of Aurora Replicas in an Aurora DB cluster. Available for Aurora MySQL-compatible edition and Aurora PostgreSQL-compatible edition.sagemaker:variant:DesiredInstanceCount
- The number of EC2 instances for an Amazon SageMaker model endpoint variant.custom-resource:ResourceType:Property
- The scalable dimension for a custom resource provided by your own application or service.comprehend:document-classifier-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend document classification endpoint.comprehend:entity-recognizer-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend entity recognizer endpoint.lambda:function:ProvisionedConcurrency
- The provisioned concurrency for a Lambda function.cassandra:table:ReadCapacityUnits
- The provisioned read capacity for an Amazon Keyspaces table.cassandra:table:WriteCapacityUnits
- The provisioned write capacity for an Amazon Keyspaces table.kafka:broker-storage:VolumeSize
- The provisioned volume size (in GiB) for brokers in an Amazon MSK cluster.
-
:max_results
(Integer)
—
The maximum number of scalable targets. This value can be between 1 and 50. The default value is 50.
If this parameter is used, the operation returns up to
MaxResults
results at a time, along with aNextToken
value. To get the next set of results, include theNextToken
value in a subsequent call. If this parameter is not used, the operation returns up to 50 results and aNextToken
value, if applicable. -
:next_token
(String)
—
The token for the next set of results.
Returns:
-
(Types::DescribeScalingActivitiesResponse)
—
Returns a response object which responds to the following methods:
- #scaling_activities => Array<Types::ScalingActivity>
- #next_token => String
See Also:
#describe_scaling_policies(options = {}) ⇒ Types::DescribeScalingPoliciesResponse
Describes the Application Auto Scaling scaling policies for the specified service namespace.
You can filter the results using ResourceId
, ScalableDimension
, and PolicyNames
.
For more information, see Target Tracking Scaling Policies and Step Scaling Policies in the Application Auto Scaling User Guide.
Examples:
Example: To describe scaling policies
# This example describes the scaling policies for the ECS service namespace.
resp = client.describe_scaling_policies({
service_namespace: "ecs",
})
# resp.to_h outputs the following:
{
next_token: "",
scaling_policies: [
{
alarms: [
{
alarm_arn: "arn:aws:cloudwatch:us-west-2:012345678910:alarm:web-app-cpu-gt-75",
alarm_name: "web-app-cpu-gt-75",
},
],
creation_time: Time.parse("2019-05-06T12:11:39.230Z"),
policy_arn: "arn:aws:autoscaling:us-west-2:012345678910:scalingPolicy:6d8972f3-efc8-437c-92d1-6270f29a66e7:resource/ecs/service/default/web-app:policyName/web-app-cpu-gt-75",
policy_name: "web-app-cpu-gt-75",
policy_type: "StepScaling",
resource_id: "service/default/web-app",
scalable_dimension: "ecs:service:DesiredCount",
service_namespace: "ecs",
step_scaling_policy_configuration: {
adjustment_type: "PercentChangeInCapacity",
cooldown: 60,
step_adjustments: [
{
metric_interval_lower_bound: 0,
scaling_adjustment: 200,
},
],
},
},
],
}
Request syntax with placeholder values
resp = client.describe_scaling_policies({
policy_names: ["ResourceIdMaxLen1600"],
service_namespace: "ecs", # required, accepts ecs, elasticmapreduce, ec2, appstream, dynamodb, rds, sagemaker, custom-resource, comprehend, lambda, cassandra, kafka
resource_id: "ResourceIdMaxLen1600",
scalable_dimension: "ecs:service:DesiredCount", # accepts ecs:service:DesiredCount, ec2:spot-fleet-request:TargetCapacity, elasticmapreduce:instancegroup:InstanceCount, appstream:fleet:DesiredCapacity, dynamodb:table:ReadCapacityUnits, dynamodb:table:WriteCapacityUnits, dynamodb:index:ReadCapacityUnits, dynamodb:index:WriteCapacityUnits, rds:cluster:ReadReplicaCount, sagemaker:variant:DesiredInstanceCount, custom-resource:ResourceType:Property, comprehend:document-classifier-endpoint:DesiredInferenceUnits, comprehend:entity-recognizer-endpoint:DesiredInferenceUnits, lambda:function:ProvisionedConcurrency, cassandra:table:ReadCapacityUnits, cassandra:table:WriteCapacityUnits, kafka:broker-storage:VolumeSize
max_results: 1,
next_token: "XmlString",
})
Response structure
resp.scaling_policies #=> Array
resp.scaling_policies[0].policy_arn #=> String
resp.scaling_policies[0].policy_name #=> String
resp.scaling_policies[0].service_namespace #=> String, one of "ecs", "elasticmapreduce", "ec2", "appstream", "dynamodb", "rds", "sagemaker", "custom-resource", "comprehend", "lambda", "cassandra", "kafka"
resp.scaling_policies[0].resource_id #=> String
resp.scaling_policies[0].scalable_dimension #=> String, one of "ecs:service:DesiredCount", "ec2:spot-fleet-request:TargetCapacity", "elasticmapreduce:instancegroup:InstanceCount", "appstream:fleet:DesiredCapacity", "dynamodb:table:ReadCapacityUnits", "dynamodb:table:WriteCapacityUnits", "dynamodb:index:ReadCapacityUnits", "dynamodb:index:WriteCapacityUnits", "rds:cluster:ReadReplicaCount", "sagemaker:variant:DesiredInstanceCount", "custom-resource:ResourceType:Property", "comprehend:document-classifier-endpoint:DesiredInferenceUnits", "comprehend:entity-recognizer-endpoint:DesiredInferenceUnits", "lambda:function:ProvisionedConcurrency", "cassandra:table:ReadCapacityUnits", "cassandra:table:WriteCapacityUnits", "kafka:broker-storage:VolumeSize"
resp.scaling_policies[0].policy_type #=> String, one of "StepScaling", "TargetTrackingScaling"
resp.scaling_policies[0].step_scaling_policy_configuration.adjustment_type #=> String, one of "ChangeInCapacity", "PercentChangeInCapacity", "ExactCapacity"
resp.scaling_policies[0].step_scaling_policy_configuration.step_adjustments #=> Array
resp.scaling_policies[0].step_scaling_policy_configuration.step_adjustments[0].metric_interval_lower_bound #=> Float
resp.scaling_policies[0].step_scaling_policy_configuration.step_adjustments[0].metric_interval_upper_bound #=> Float
resp.scaling_policies[0].step_scaling_policy_configuration.step_adjustments[0].scaling_adjustment #=> Integer
resp.scaling_policies[0].step_scaling_policy_configuration.min_adjustment_magnitude #=> Integer
resp.scaling_policies[0].step_scaling_policy_configuration.cooldown #=> Integer
resp.scaling_policies[0].step_scaling_policy_configuration.metric_aggregation_type #=> String, one of "Average", "Minimum", "Maximum"
resp.scaling_policies[0].target_tracking_scaling_policy_configuration.target_value #=> Float
resp.scaling_policies[0].target_tracking_scaling_policy_configuration.predefined_metric_specification.predefined_metric_type #=> String, one of "DynamoDBReadCapacityUtilization", "DynamoDBWriteCapacityUtilization", "ALBRequestCountPerTarget", "RDSReaderAverageCPUUtilization", "RDSReaderAverageDatabaseConnections", "EC2SpotFleetRequestAverageCPUUtilization", "EC2SpotFleetRequestAverageNetworkIn", "EC2SpotFleetRequestAverageNetworkOut", "SageMakerVariantInvocationsPerInstance", "ECSServiceAverageCPUUtilization", "ECSServiceAverageMemoryUtilization", "AppStreamAverageCapacityUtilization", "ComprehendInferenceUtilization", "LambdaProvisionedConcurrencyUtilization", "CassandraReadCapacityUtilization", "CassandraWriteCapacityUtilization", "KafkaBrokerStorageUtilization"
resp.scaling_policies[0].target_tracking_scaling_policy_configuration.predefined_metric_specification.resource_label #=> String
resp.scaling_policies[0].target_tracking_scaling_policy_configuration.customized_metric_specification.metric_name #=> String
resp.scaling_policies[0].target_tracking_scaling_policy_configuration.customized_metric_specification.namespace #=> String
resp.scaling_policies[0].target_tracking_scaling_policy_configuration.customized_metric_specification.dimensions #=> Array
resp.scaling_policies[0].target_tracking_scaling_policy_configuration.customized_metric_specification.dimensions[0].name #=> String
resp.scaling_policies[0].target_tracking_scaling_policy_configuration.customized_metric_specification.dimensions[0].value #=> String
resp.scaling_policies[0].target_tracking_scaling_policy_configuration.customized_metric_specification.statistic #=> String, one of "Average", "Minimum", "Maximum", "SampleCount", "Sum"
resp.scaling_policies[0].target_tracking_scaling_policy_configuration.customized_metric_specification.unit #=> String
resp.scaling_policies[0].target_tracking_scaling_policy_configuration.scale_out_cooldown #=> Integer
resp.scaling_policies[0].target_tracking_scaling_policy_configuration.scale_in_cooldown #=> Integer
resp.scaling_policies[0].target_tracking_scaling_policy_configuration.disable_scale_in #=> true/false
resp.scaling_policies[0].alarms #=> Array
resp.scaling_policies[0].alarms[0].alarm_name #=> String
resp.scaling_policies[0].alarms[0].alarm_arn #=> String
resp.scaling_policies[0].creation_time #=> Time
resp.next_token #=> String
Options Hash (options):
-
:policy_names
(Array<String>)
—
The names of the scaling policies to describe.
-
:service_namespace
(required, String)
—
The namespace of the AWS service that provides the resource. For a resource provided by your own application or service, use
custom-resource
instead. -
:resource_id
(String)
—
The identifier of the resource associated with the scaling policy. This string consists of the resource type and unique identifier. If you specify a scalable dimension, you must also specify a resource ID.
ECS service - The resource type is
service
and the unique identifier is the cluster name and service name. Example:service/default/sample-webapp
.Spot Fleet request - The resource type is
spot-fleet-request
and the unique identifier is the Spot Fleet request ID. Example:spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE
.EMR cluster - The resource type is
instancegroup
and the unique identifier is the cluster ID and instance group ID. Example:instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0
.AppStream 2.0 fleet - The resource type is
fleet
and the unique identifier is the fleet name. Example:fleet/sample-fleet
.DynamoDB table - The resource type is
table
and the unique identifier is the table name. Example:table/my-table
.DynamoDB global secondary index - The resource type is
index
and the unique identifier is the index name. Example:table/my-table/index/my-table-index
.Aurora DB cluster - The resource type is
cluster
and the unique identifier is the cluster name. Example:cluster:my-db-cluster
.Amazon SageMaker endpoint variant - The resource type is
variant
and the unique identifier is the resource ID. Example:endpoint/my-end-point/variant/KMeansClustering
.Custom resources are not supported with a resource type. This parameter must specify the
OutputValue
from the CloudFormation template stack used to access the resources. The unique identifier is defined by the service provider. More information is available in our GitHub repository.Amazon Comprehend document classification endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:document-classifier-endpoint/EXAMPLE
.Amazon Comprehend entity recognizer endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:entity-recognizer-endpoint/EXAMPLE
.Lambda provisioned concurrency - The resource type is
function
and the unique identifier is the function name with a function version or alias name suffix that is not$LATEST
. Example:function:my-function:prod
orfunction:my-function:1
.Amazon Keyspaces table - The resource type is
table
and the unique identifier is the table name. Example:keyspace/mykeyspace/table/mytable
.Amazon MSK cluster - The resource type and unique identifier are specified using the cluster ARN. Example:
arn:aws:kafka:us-east-1:123456789012:cluster/demo-cluster-1/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5
.
-
:scalable_dimension
(String)
—
The scalable dimension. This string consists of the service namespace, resource type, and scaling property. If you specify a scalable dimension, you must also specify a resource ID.
ecs:service:DesiredCount
- The desired task count of an ECS service.ec2:spot-fleet-request:TargetCapacity
- The target capacity of a Spot Fleet request.elasticmapreduce:instancegroup:InstanceCount
- The instance count of an EMR Instance Group.appstream:fleet:DesiredCapacity
- The desired capacity of an AppStream 2.0 fleet.dynamodb:table:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB table.dynamodb:table:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB table.dynamodb:index:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB global secondary index.dynamodb:index:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB global secondary index.rds:cluster:ReadReplicaCount
- The count of Aurora Replicas in an Aurora DB cluster. Available for Aurora MySQL-compatible edition and Aurora PostgreSQL-compatible edition.sagemaker:variant:DesiredInstanceCount
- The number of EC2 instances for an Amazon SageMaker model endpoint variant.custom-resource:ResourceType:Property
- The scalable dimension for a custom resource provided by your own application or service.comprehend:document-classifier-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend document classification endpoint.comprehend:entity-recognizer-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend entity recognizer endpoint.lambda:function:ProvisionedConcurrency
- The provisioned concurrency for a Lambda function.cassandra:table:ReadCapacityUnits
- The provisioned read capacity for an Amazon Keyspaces table.cassandra:table:WriteCapacityUnits
- The provisioned write capacity for an Amazon Keyspaces table.kafka:broker-storage:VolumeSize
- The provisioned volume size (in GiB) for brokers in an Amazon MSK cluster.
-
:max_results
(Integer)
—
The maximum number of scalable targets. This value can be between 1 and 50. The default value is 50.
If this parameter is used, the operation returns up to
MaxResults
results at a time, along with aNextToken
value. To get the next set of results, include theNextToken
value in a subsequent call. If this parameter is not used, the operation returns up to 50 results and aNextToken
value, if applicable. -
:next_token
(String)
—
The token for the next set of results.
Returns:
-
(Types::DescribeScalingPoliciesResponse)
—
Returns a response object which responds to the following methods:
- #scaling_policies => Array<Types::ScalingPolicy>
- #next_token => String
See Also:
#describe_scheduled_actions(options = {}) ⇒ Types::DescribeScheduledActionsResponse
Describes the Application Auto Scaling scheduled actions for the specified service namespace.
You can filter the results using the ResourceId
, ScalableDimension
, and ScheduledActionNames
parameters.
For more information, see Scheduled Scaling in the Application Auto Scaling User Guide.
Examples:
Request syntax with placeholder values
resp = client.describe_scheduled_actions({
scheduled_action_names: ["ResourceIdMaxLen1600"],
service_namespace: "ecs", # required, accepts ecs, elasticmapreduce, ec2, appstream, dynamodb, rds, sagemaker, custom-resource, comprehend, lambda, cassandra, kafka
resource_id: "ResourceIdMaxLen1600",
scalable_dimension: "ecs:service:DesiredCount", # accepts ecs:service:DesiredCount, ec2:spot-fleet-request:TargetCapacity, elasticmapreduce:instancegroup:InstanceCount, appstream:fleet:DesiredCapacity, dynamodb:table:ReadCapacityUnits, dynamodb:table:WriteCapacityUnits, dynamodb:index:ReadCapacityUnits, dynamodb:index:WriteCapacityUnits, rds:cluster:ReadReplicaCount, sagemaker:variant:DesiredInstanceCount, custom-resource:ResourceType:Property, comprehend:document-classifier-endpoint:DesiredInferenceUnits, comprehend:entity-recognizer-endpoint:DesiredInferenceUnits, lambda:function:ProvisionedConcurrency, cassandra:table:ReadCapacityUnits, cassandra:table:WriteCapacityUnits, kafka:broker-storage:VolumeSize
max_results: 1,
next_token: "XmlString",
})
Response structure
resp.scheduled_actions #=> Array
resp.scheduled_actions[0].scheduled_action_name #=> String
resp.scheduled_actions[0].scheduled_action_arn #=> String
resp.scheduled_actions[0].service_namespace #=> String, one of "ecs", "elasticmapreduce", "ec2", "appstream", "dynamodb", "rds", "sagemaker", "custom-resource", "comprehend", "lambda", "cassandra", "kafka"
resp.scheduled_actions[0].schedule #=> String
resp.scheduled_actions[0].resource_id #=> String
resp.scheduled_actions[0].scalable_dimension #=> String, one of "ecs:service:DesiredCount", "ec2:spot-fleet-request:TargetCapacity", "elasticmapreduce:instancegroup:InstanceCount", "appstream:fleet:DesiredCapacity", "dynamodb:table:ReadCapacityUnits", "dynamodb:table:WriteCapacityUnits", "dynamodb:index:ReadCapacityUnits", "dynamodb:index:WriteCapacityUnits", "rds:cluster:ReadReplicaCount", "sagemaker:variant:DesiredInstanceCount", "custom-resource:ResourceType:Property", "comprehend:document-classifier-endpoint:DesiredInferenceUnits", "comprehend:entity-recognizer-endpoint:DesiredInferenceUnits", "lambda:function:ProvisionedConcurrency", "cassandra:table:ReadCapacityUnits", "cassandra:table:WriteCapacityUnits", "kafka:broker-storage:VolumeSize"
resp.scheduled_actions[0].start_time #=> Time
resp.scheduled_actions[0].end_time #=> Time
resp.scheduled_actions[0].scalable_target_action.min_capacity #=> Integer
resp.scheduled_actions[0].scalable_target_action.max_capacity #=> Integer
resp.scheduled_actions[0].creation_time #=> Time
resp.next_token #=> String
Options Hash (options):
-
:scheduled_action_names
(Array<String>)
—
The names of the scheduled actions to describe.
-
:service_namespace
(required, String)
—
The namespace of the AWS service that provides the resource. For a resource provided by your own application or service, use
custom-resource
instead. -
:resource_id
(String)
—
The identifier of the resource associated with the scheduled action. This string consists of the resource type and unique identifier. If you specify a scalable dimension, you must also specify a resource ID.
ECS service - The resource type is
service
and the unique identifier is the cluster name and service name. Example:service/default/sample-webapp
.Spot Fleet request - The resource type is
spot-fleet-request
and the unique identifier is the Spot Fleet request ID. Example:spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE
.EMR cluster - The resource type is
instancegroup
and the unique identifier is the cluster ID and instance group ID. Example:instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0
.AppStream 2.0 fleet - The resource type is
fleet
and the unique identifier is the fleet name. Example:fleet/sample-fleet
.DynamoDB table - The resource type is
table
and the unique identifier is the table name. Example:table/my-table
.DynamoDB global secondary index - The resource type is
index
and the unique identifier is the index name. Example:table/my-table/index/my-table-index
.Aurora DB cluster - The resource type is
cluster
and the unique identifier is the cluster name. Example:cluster:my-db-cluster
.Amazon SageMaker endpoint variant - The resource type is
variant
and the unique identifier is the resource ID. Example:endpoint/my-end-point/variant/KMeansClustering
.Custom resources are not supported with a resource type. This parameter must specify the
OutputValue
from the CloudFormation template stack used to access the resources. The unique identifier is defined by the service provider. More information is available in our GitHub repository.Amazon Comprehend document classification endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:document-classifier-endpoint/EXAMPLE
.Amazon Comprehend entity recognizer endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:entity-recognizer-endpoint/EXAMPLE
.Lambda provisioned concurrency - The resource type is
function
and the unique identifier is the function name with a function version or alias name suffix that is not$LATEST
. Example:function:my-function:prod
orfunction:my-function:1
.Amazon Keyspaces table - The resource type is
table
and the unique identifier is the table name. Example:keyspace/mykeyspace/table/mytable
.Amazon MSK cluster - The resource type and unique identifier are specified using the cluster ARN. Example:
arn:aws:kafka:us-east-1:123456789012:cluster/demo-cluster-1/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5
.
-
:scalable_dimension
(String)
—
The scalable dimension. This string consists of the service namespace, resource type, and scaling property. If you specify a scalable dimension, you must also specify a resource ID.
ecs:service:DesiredCount
- The desired task count of an ECS service.ec2:spot-fleet-request:TargetCapacity
- The target capacity of a Spot Fleet request.elasticmapreduce:instancegroup:InstanceCount
- The instance count of an EMR Instance Group.appstream:fleet:DesiredCapacity
- The desired capacity of an AppStream 2.0 fleet.dynamodb:table:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB table.dynamodb:table:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB table.dynamodb:index:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB global secondary index.dynamodb:index:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB global secondary index.rds:cluster:ReadReplicaCount
- The count of Aurora Replicas in an Aurora DB cluster. Available for Aurora MySQL-compatible edition and Aurora PostgreSQL-compatible edition.sagemaker:variant:DesiredInstanceCount
- The number of EC2 instances for an Amazon SageMaker model endpoint variant.custom-resource:ResourceType:Property
- The scalable dimension for a custom resource provided by your own application or service.comprehend:document-classifier-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend document classification endpoint.comprehend:entity-recognizer-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend entity recognizer endpoint.lambda:function:ProvisionedConcurrency
- The provisioned concurrency for a Lambda function.cassandra:table:ReadCapacityUnits
- The provisioned read capacity for an Amazon Keyspaces table.cassandra:table:WriteCapacityUnits
- The provisioned write capacity for an Amazon Keyspaces table.kafka:broker-storage:VolumeSize
- The provisioned volume size (in GiB) for brokers in an Amazon MSK cluster.
-
:max_results
(Integer)
—
The maximum number of scheduled action results. This value can be between 1 and 50. The default value is 50.
If this parameter is used, the operation returns up to
MaxResults
results at a time, along with aNextToken
value. To get the next set of results, include theNextToken
value in a subsequent call. If this parameter is not used, the operation returns up to 50 results and aNextToken
value, if applicable. -
:next_token
(String)
—
The token for the next set of results.
Returns:
-
(Types::DescribeScheduledActionsResponse)
—
Returns a response object which responds to the following methods:
- #scheduled_actions => Array<Types::ScheduledAction>
- #next_token => String
See Also:
#put_scaling_policy(options = {}) ⇒ Types::PutScalingPolicyResponse
Creates or updates a scaling policy for an Application Auto Scaling scalable target.
Each scalable target is identified by a service namespace, resource ID, and scalable dimension. A scaling policy applies to the scalable target identified by those three attributes. You cannot create a scaling policy until you have registered the resource as a scalable target.
Multiple scaling policies can be in force at the same time for the same scalable target. You can have one or more target tracking scaling policies, one or more step scaling policies, or both. However, there is a chance that multiple policies could conflict, instructing the scalable target to scale out or in at the same time. Application Auto Scaling gives precedence to the policy that provides the largest capacity for both scale out and scale in. For example, if one policy increases capacity by 3, another policy increases capacity by 200 percent, and the current capacity is 10, Application Auto Scaling uses the policy with the highest calculated capacity (200% of 10 = 20) and scales out to 30.
We recommend caution, however, when using target tracking scaling policies with step scaling policies because conflicts between these policies can cause undesirable behavior. For example, if the step scaling policy initiates a scale-in activity before the target tracking policy is ready to scale in, the scale-in activity will not be blocked. After the scale-in activity completes, the target tracking policy could instruct the scalable target to scale out again.
For more information, see Target Tracking Scaling Policies and Step Scaling Policies in the Application Auto Scaling User Guide.
If a scalable target is deregistered, the scalable target is no longer available to execute scaling policies. Any scaling policies that were specified for the scalable target are deleted.
Examples:
Example: To apply a target tracking scaling policy with a predefined metric specification
# The following example applies a target tracking scaling policy with a predefined metric specification to an Amazon ECS service called web-app in the default cluster. The policy keeps the average CPU utilization of the service at 75 percent, with scale-out and scale-in cooldown periods of 60 seconds.
resp = client.put_scaling_policy({
policy_name: "cpu75-target-tracking-scaling-policy",
policy_type: "TargetTrackingScaling",
resource_id: "service/default/web-app",
scalable_dimension: "ecs:service:DesiredCount",
service_namespace: "ecs",
target_tracking_scaling_policy_configuration: {
predefined_metric_specification: {
predefined_metric_type: "ECSServiceAverageCPUUtilization",
},
scale_in_cooldown: 60,
scale_out_cooldown: 60,
target_value: 75,
},
})
# resp.to_h outputs the following:
{
alarms: [
{
alarm_arn: "arn:aws:cloudwatch:us-west-2:012345678910:alarm:TargetTracking-service/default/web-app-AlarmHigh-d4f0770c-b46e-434a-a60f-3b36d653feca",
alarm_name: "TargetTracking-service/default/web-app-AlarmHigh-d4f0770c-b46e-434a-a60f-3b36d653feca",
},
{
alarm_arn: "arn:aws:cloudwatch:us-west-2:012345678910:alarm:TargetTracking-service/default/web-app-AlarmLow-1b437334-d19b-4a63-a812-6c67aaf2910d",
alarm_name: "TargetTracking-service/default/web-app-AlarmLow-1b437334-d19b-4a63-a812-6c67aaf2910d",
},
],
policy_arn: "arn:aws:autoscaling:us-west-2:012345678910:scalingPolicy:6d8972f3-efc8-437c-92d1-6270f29a66e7:resource/ecs/service/default/web-app:policyName/cpu75-target-tracking-scaling-policy",
}
Request syntax with placeholder values
resp = client.put_scaling_policy({
policy_name: "PolicyName", # required
service_namespace: "ecs", # required, accepts ecs, elasticmapreduce, ec2, appstream, dynamodb, rds, sagemaker, custom-resource, comprehend, lambda, cassandra, kafka
resource_id: "ResourceIdMaxLen1600", # required
scalable_dimension: "ecs:service:DesiredCount", # required, accepts ecs:service:DesiredCount, ec2:spot-fleet-request:TargetCapacity, elasticmapreduce:instancegroup:InstanceCount, appstream:fleet:DesiredCapacity, dynamodb:table:ReadCapacityUnits, dynamodb:table:WriteCapacityUnits, dynamodb:index:ReadCapacityUnits, dynamodb:index:WriteCapacityUnits, rds:cluster:ReadReplicaCount, sagemaker:variant:DesiredInstanceCount, custom-resource:ResourceType:Property, comprehend:document-classifier-endpoint:DesiredInferenceUnits, comprehend:entity-recognizer-endpoint:DesiredInferenceUnits, lambda:function:ProvisionedConcurrency, cassandra:table:ReadCapacityUnits, cassandra:table:WriteCapacityUnits, kafka:broker-storage:VolumeSize
policy_type: "StepScaling", # accepts StepScaling, TargetTrackingScaling
step_scaling_policy_configuration: {
adjustment_type: "ChangeInCapacity", # accepts ChangeInCapacity, PercentChangeInCapacity, ExactCapacity
step_adjustments: [
{
metric_interval_lower_bound: 1.0,
metric_interval_upper_bound: 1.0,
scaling_adjustment: 1, # required
},
],
min_adjustment_magnitude: 1,
cooldown: 1,
metric_aggregation_type: "Average", # accepts Average, Minimum, Maximum
},
target_tracking_scaling_policy_configuration: {
target_value: 1.0, # required
predefined_metric_specification: {
predefined_metric_type: "DynamoDBReadCapacityUtilization", # required, accepts DynamoDBReadCapacityUtilization, DynamoDBWriteCapacityUtilization, ALBRequestCountPerTarget, RDSReaderAverageCPUUtilization, RDSReaderAverageDatabaseConnections, EC2SpotFleetRequestAverageCPUUtilization, EC2SpotFleetRequestAverageNetworkIn, EC2SpotFleetRequestAverageNetworkOut, SageMakerVariantInvocationsPerInstance, ECSServiceAverageCPUUtilization, ECSServiceAverageMemoryUtilization, AppStreamAverageCapacityUtilization, ComprehendInferenceUtilization, LambdaProvisionedConcurrencyUtilization, CassandraReadCapacityUtilization, CassandraWriteCapacityUtilization, KafkaBrokerStorageUtilization
resource_label: "ResourceLabel",
},
customized_metric_specification: {
metric_name: "MetricName", # required
namespace: "MetricNamespace", # required
dimensions: [
{
name: "MetricDimensionName", # required
value: "MetricDimensionValue", # required
},
],
statistic: "Average", # required, accepts Average, Minimum, Maximum, SampleCount, Sum
unit: "MetricUnit",
},
scale_out_cooldown: 1,
scale_in_cooldown: 1,
disable_scale_in: false,
},
})
Response structure
resp.policy_arn #=> String
resp.alarms #=> Array
resp.alarms[0].alarm_name #=> String
resp.alarms[0].alarm_arn #=> String
Options Hash (options):
-
:policy_name
(required, String)
—
The name of the scaling policy.
-
:service_namespace
(required, String)
—
The namespace of the AWS service that provides the resource. For a resource provided by your own application or service, use
custom-resource
instead. -
:resource_id
(required, String)
—
The identifier of the resource associated with the scaling policy. This string consists of the resource type and unique identifier.
ECS service - The resource type is
service
and the unique identifier is the cluster name and service name. Example:service/default/sample-webapp
.Spot Fleet request - The resource type is
spot-fleet-request
and the unique identifier is the Spot Fleet request ID. Example:spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE
.EMR cluster - The resource type is
instancegroup
and the unique identifier is the cluster ID and instance group ID. Example:instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0
.AppStream 2.0 fleet - The resource type is
fleet
and the unique identifier is the fleet name. Example:fleet/sample-fleet
.DynamoDB table - The resource type is
table
and the unique identifier is the table name. Example:table/my-table
.DynamoDB global secondary index - The resource type is
index
and the unique identifier is the index name. Example:table/my-table/index/my-table-index
.Aurora DB cluster - The resource type is
cluster
and the unique identifier is the cluster name. Example:cluster:my-db-cluster
.Amazon SageMaker endpoint variant - The resource type is
variant
and the unique identifier is the resource ID. Example:endpoint/my-end-point/variant/KMeansClustering
.Custom resources are not supported with a resource type. This parameter must specify the
OutputValue
from the CloudFormation template stack used to access the resources. The unique identifier is defined by the service provider. More information is available in our GitHub repository.Amazon Comprehend document classification endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:document-classifier-endpoint/EXAMPLE
.Amazon Comprehend entity recognizer endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:entity-recognizer-endpoint/EXAMPLE
.Lambda provisioned concurrency - The resource type is
function
and the unique identifier is the function name with a function version or alias name suffix that is not$LATEST
. Example:function:my-function:prod
orfunction:my-function:1
.Amazon Keyspaces table - The resource type is
table
and the unique identifier is the table name. Example:keyspace/mykeyspace/table/mytable
.Amazon MSK cluster - The resource type and unique identifier are specified using the cluster ARN. Example:
arn:aws:kafka:us-east-1:123456789012:cluster/demo-cluster-1/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5
.
-
:scalable_dimension
(required, String)
—
The scalable dimension. This string consists of the service namespace, resource type, and scaling property.
ecs:service:DesiredCount
- The desired task count of an ECS service.ec2:spot-fleet-request:TargetCapacity
- The target capacity of a Spot Fleet request.elasticmapreduce:instancegroup:InstanceCount
- The instance count of an EMR Instance Group.appstream:fleet:DesiredCapacity
- The desired capacity of an AppStream 2.0 fleet.dynamodb:table:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB table.dynamodb:table:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB table.dynamodb:index:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB global secondary index.dynamodb:index:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB global secondary index.rds:cluster:ReadReplicaCount
- The count of Aurora Replicas in an Aurora DB cluster. Available for Aurora MySQL-compatible edition and Aurora PostgreSQL-compatible edition.sagemaker:variant:DesiredInstanceCount
- The number of EC2 instances for an Amazon SageMaker model endpoint variant.custom-resource:ResourceType:Property
- The scalable dimension for a custom resource provided by your own application or service.comprehend:document-classifier-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend document classification endpoint.comprehend:entity-recognizer-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend entity recognizer endpoint.lambda:function:ProvisionedConcurrency
- The provisioned concurrency for a Lambda function.cassandra:table:ReadCapacityUnits
- The provisioned read capacity for an Amazon Keyspaces table.cassandra:table:WriteCapacityUnits
- The provisioned write capacity for an Amazon Keyspaces table.kafka:broker-storage:VolumeSize
- The provisioned volume size (in GiB) for brokers in an Amazon MSK cluster.
-
:policy_type
(String)
—
The policy type. This parameter is required if you are creating a scaling policy.
The following policy types are supported:
TargetTrackingScaling
—Not supported for Amazon EMRStepScaling
—Not supported for DynamoDB, Amazon Comprehend, Lambda, Amazon Keyspaces (for Apache Cassandra), or Amazon MSK.For more information, see Target Tracking Scaling Policies and Step Scaling Policies in the Application Auto Scaling User Guide.
-
:step_scaling_policy_configuration
(Types::StepScalingPolicyConfiguration)
—
A step scaling policy.
This parameter is required if you are creating a policy and the policy type is
StepScaling
. -
:target_tracking_scaling_policy_configuration
(Types::TargetTrackingScalingPolicyConfiguration)
—
A target tracking scaling policy. Includes support for predefined or customized metrics.
This parameter is required if you are creating a policy and the policy type is
TargetTrackingScaling
.
Returns:
-
(Types::PutScalingPolicyResponse)
—
Returns a response object which responds to the following methods:
- #policy_arn => String
- #alarms => Array<Types::Alarm>
See Also:
#put_scheduled_action(options = {}) ⇒ Struct
Creates or updates a scheduled action for an Application Auto Scaling scalable target.
Each scalable target is identified by a service namespace, resource ID, and scalable dimension. A scheduled action applies to the scalable target identified by those three attributes. You cannot create a scheduled action until you have registered the resource as a scalable target.
When start and end times are specified with a recurring schedule using a cron expression or rates, they form the boundaries of when the recurring action starts and stops.
To update a scheduled action, specify the parameters that you want to change. If you don't specify start and end times, the old values are deleted.
For more information, see Scheduled Scaling in the Application Auto Scaling User Guide.
If a scalable target is deregistered, the scalable target is no longer available to run scheduled actions. Any scheduled actions that were specified for the scalable target are deleted.
Examples:
Request syntax with placeholder values
resp = client.put_scheduled_action({
service_namespace: "ecs", # required, accepts ecs, elasticmapreduce, ec2, appstream, dynamodb, rds, sagemaker, custom-resource, comprehend, lambda, cassandra, kafka
schedule: "ResourceIdMaxLen1600",
scheduled_action_name: "ScheduledActionName", # required
resource_id: "ResourceIdMaxLen1600", # required
scalable_dimension: "ecs:service:DesiredCount", # required, accepts ecs:service:DesiredCount, ec2:spot-fleet-request:TargetCapacity, elasticmapreduce:instancegroup:InstanceCount, appstream:fleet:DesiredCapacity, dynamodb:table:ReadCapacityUnits, dynamodb:table:WriteCapacityUnits, dynamodb:index:ReadCapacityUnits, dynamodb:index:WriteCapacityUnits, rds:cluster:ReadReplicaCount, sagemaker:variant:DesiredInstanceCount, custom-resource:ResourceType:Property, comprehend:document-classifier-endpoint:DesiredInferenceUnits, comprehend:entity-recognizer-endpoint:DesiredInferenceUnits, lambda:function:ProvisionedConcurrency, cassandra:table:ReadCapacityUnits, cassandra:table:WriteCapacityUnits, kafka:broker-storage:VolumeSize
start_time: Time.now,
end_time: Time.now,
scalable_target_action: {
min_capacity: 1,
max_capacity: 1,
},
})
Options Hash (options):
-
:service_namespace
(required, String)
—
The namespace of the AWS service that provides the resource. For a resource provided by your own application or service, use
custom-resource
instead. -
:schedule
(String)
—
The schedule for this action. The following formats are supported:
At expressions - \"
at(yyyy-mm-ddThh:mm:ss)
\"Rate expressions - \"
rate(value unit)
\"Cron expressions - \"
cron(fields)
\"
At expressions are useful for one-time schedules. Specify the time in UTC.
For rate expressions, value is a positive integer and unit is
minute
|minutes
|hour
|hours
|day
|days
.For more information about cron expressions, see Cron Expressions in the Amazon CloudWatch Events User Guide.
For examples of using these expressions, see Scheduled Scaling in the Application Auto Scaling User Guide.
-
:scheduled_action_name
(required, String)
—
The name of the scheduled action. This name must be unique among all other scheduled actions on the specified scalable target.
-
:resource_id
(required, String)
—
The identifier of the resource associated with the scheduled action. This string consists of the resource type and unique identifier.
ECS service - The resource type is
service
and the unique identifier is the cluster name and service name. Example:service/default/sample-webapp
.Spot Fleet request - The resource type is
spot-fleet-request
and the unique identifier is the Spot Fleet request ID. Example:spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE
.EMR cluster - The resource type is
instancegroup
and the unique identifier is the cluster ID and instance group ID. Example:instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0
.AppStream 2.0 fleet - The resource type is
fleet
and the unique identifier is the fleet name. Example:fleet/sample-fleet
.DynamoDB table - The resource type is
table
and the unique identifier is the table name. Example:table/my-table
.DynamoDB global secondary index - The resource type is
index
and the unique identifier is the index name. Example:table/my-table/index/my-table-index
.Aurora DB cluster - The resource type is
cluster
and the unique identifier is the cluster name. Example:cluster:my-db-cluster
.Amazon SageMaker endpoint variant - The resource type is
variant
and the unique identifier is the resource ID. Example:endpoint/my-end-point/variant/KMeansClustering
.Custom resources are not supported with a resource type. This parameter must specify the
OutputValue
from the CloudFormation template stack used to access the resources. The unique identifier is defined by the service provider. More information is available in our GitHub repository.Amazon Comprehend document classification endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:document-classifier-endpoint/EXAMPLE
.Amazon Comprehend entity recognizer endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:entity-recognizer-endpoint/EXAMPLE
.Lambda provisioned concurrency - The resource type is
function
and the unique identifier is the function name with a function version or alias name suffix that is not$LATEST
. Example:function:my-function:prod
orfunction:my-function:1
.Amazon Keyspaces table - The resource type is
table
and the unique identifier is the table name. Example:keyspace/mykeyspace/table/mytable
.Amazon MSK cluster - The resource type and unique identifier are specified using the cluster ARN. Example:
arn:aws:kafka:us-east-1:123456789012:cluster/demo-cluster-1/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5
.
-
:scalable_dimension
(required, String)
—
The scalable dimension. This string consists of the service namespace, resource type, and scaling property.
ecs:service:DesiredCount
- The desired task count of an ECS service.ec2:spot-fleet-request:TargetCapacity
- The target capacity of a Spot Fleet request.elasticmapreduce:instancegroup:InstanceCount
- The instance count of an EMR Instance Group.appstream:fleet:DesiredCapacity
- The desired capacity of an AppStream 2.0 fleet.dynamodb:table:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB table.dynamodb:table:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB table.dynamodb:index:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB global secondary index.dynamodb:index:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB global secondary index.rds:cluster:ReadReplicaCount
- The count of Aurora Replicas in an Aurora DB cluster. Available for Aurora MySQL-compatible edition and Aurora PostgreSQL-compatible edition.sagemaker:variant:DesiredInstanceCount
- The number of EC2 instances for an Amazon SageMaker model endpoint variant.custom-resource:ResourceType:Property
- The scalable dimension for a custom resource provided by your own application or service.comprehend:document-classifier-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend document classification endpoint.comprehend:entity-recognizer-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend entity recognizer endpoint.lambda:function:ProvisionedConcurrency
- The provisioned concurrency for a Lambda function.cassandra:table:ReadCapacityUnits
- The provisioned read capacity for an Amazon Keyspaces table.cassandra:table:WriteCapacityUnits
- The provisioned write capacity for an Amazon Keyspaces table.kafka:broker-storage:VolumeSize
- The provisioned volume size (in GiB) for brokers in an Amazon MSK cluster.
-
:start_time
(Time)
—
The date and time for this scheduled action to start.
-
:end_time
(Time)
—
The date and time for the recurring schedule to end.
-
:scalable_target_action
(Types::ScalableTargetAction)
—
The new minimum and maximum capacity. You can set both values or just one. At the scheduled time, if the current capacity is below the minimum capacity, Application Auto Scaling scales out to the minimum capacity. If the current capacity is above the maximum capacity, Application Auto Scaling scales in to the maximum capacity.
Returns:
-
(Struct)
—
Returns an empty response.
See Also:
#register_scalable_target(options = {}) ⇒ Struct
Registers or updates a scalable target.
A scalable target is a resource that Application Auto Scaling can scale out and scale in. Scalable targets are uniquely identified by the combination of resource ID, scalable dimension, and namespace.
When you register a new scalable target, you must specify values for minimum and maximum capacity. Current capacity will be adjusted within the specified range when scaling starts. Application Auto Scaling scaling policies will not scale capacity to values that are outside of this range.
After you register a scalable target, you do not need to register it again to use other Application Auto Scaling operations. To see which resources have been registered, use DescribeScalableTargets. You can also view the scaling policies for a service namespace by using DescribeScalableTargets. If you no longer need a scalable target, you can deregister it by using DeregisterScalableTarget.
To update a scalable target, specify the parameters that you want to change. Include the parameters that identify the scalable target: resource ID, scalable dimension, and namespace. Any parameters that you don't specify are not changed by this update request.
Examples:
Example: To register an ECS service as a scalable target
# This example registers a scalable target from an Amazon ECS service called web-app that is running on the default cluster, with a minimum desired count of 1 task and a maximum desired count of 10 tasks.
resp = client.register_scalable_target({
max_capacity: 10,
min_capacity: 1,
resource_id: "service/default/web-app",
scalable_dimension: "ecs:service:DesiredCount",
service_namespace: "ecs",
})
Request syntax with placeholder values
resp = client.register_scalable_target({
service_namespace: "ecs", # required, accepts ecs, elasticmapreduce, ec2, appstream, dynamodb, rds, sagemaker, custom-resource, comprehend, lambda, cassandra, kafka
resource_id: "ResourceIdMaxLen1600", # required
scalable_dimension: "ecs:service:DesiredCount", # required, accepts ecs:service:DesiredCount, ec2:spot-fleet-request:TargetCapacity, elasticmapreduce:instancegroup:InstanceCount, appstream:fleet:DesiredCapacity, dynamodb:table:ReadCapacityUnits, dynamodb:table:WriteCapacityUnits, dynamodb:index:ReadCapacityUnits, dynamodb:index:WriteCapacityUnits, rds:cluster:ReadReplicaCount, sagemaker:variant:DesiredInstanceCount, custom-resource:ResourceType:Property, comprehend:document-classifier-endpoint:DesiredInferenceUnits, comprehend:entity-recognizer-endpoint:DesiredInferenceUnits, lambda:function:ProvisionedConcurrency, cassandra:table:ReadCapacityUnits, cassandra:table:WriteCapacityUnits, kafka:broker-storage:VolumeSize
min_capacity: 1,
max_capacity: 1,
role_arn: "ResourceIdMaxLen1600",
suspended_state: {
dynamic_scaling_in_suspended: false,
dynamic_scaling_out_suspended: false,
scheduled_scaling_suspended: false,
},
})
Options Hash (options):
-
:service_namespace
(required, String)
—
The namespace of the AWS service that provides the resource. For a resource provided by your own application or service, use
custom-resource
instead. -
:resource_id
(required, String)
—
The identifier of the resource that is associated with the scalable target. This string consists of the resource type and unique identifier.
ECS service - The resource type is
service
and the unique identifier is the cluster name and service name. Example:service/default/sample-webapp
.Spot Fleet request - The resource type is
spot-fleet-request
and the unique identifier is the Spot Fleet request ID. Example:spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE
.EMR cluster - The resource type is
instancegroup
and the unique identifier is the cluster ID and instance group ID. Example:instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0
.AppStream 2.0 fleet - The resource type is
fleet
and the unique identifier is the fleet name. Example:fleet/sample-fleet
.DynamoDB table - The resource type is
table
and the unique identifier is the table name. Example:table/my-table
.DynamoDB global secondary index - The resource type is
index
and the unique identifier is the index name. Example:table/my-table/index/my-table-index
.Aurora DB cluster - The resource type is
cluster
and the unique identifier is the cluster name. Example:cluster:my-db-cluster
.Amazon SageMaker endpoint variant - The resource type is
variant
and the unique identifier is the resource ID. Example:endpoint/my-end-point/variant/KMeansClustering
.Custom resources are not supported with a resource type. This parameter must specify the
OutputValue
from the CloudFormation template stack used to access the resources. The unique identifier is defined by the service provider. More information is available in our GitHub repository.Amazon Comprehend document classification endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:document-classifier-endpoint/EXAMPLE
.Amazon Comprehend entity recognizer endpoint - The resource type and unique identifier are specified using the endpoint ARN. Example:
arn:aws:comprehend:us-west-2:123456789012:entity-recognizer-endpoint/EXAMPLE
.Lambda provisioned concurrency - The resource type is
function
and the unique identifier is the function name with a function version or alias name suffix that is not$LATEST
. Example:function:my-function:prod
orfunction:my-function:1
.Amazon Keyspaces table - The resource type is
table
and the unique identifier is the table name. Example:keyspace/mykeyspace/table/mytable
.Amazon MSK cluster - The resource type and unique identifier are specified using the cluster ARN. Example:
arn:aws:kafka:us-east-1:123456789012:cluster/demo-cluster-1/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5
.
-
:scalable_dimension
(required, String)
—
The scalable dimension associated with the scalable target. This string consists of the service namespace, resource type, and scaling property.
ecs:service:DesiredCount
- The desired task count of an ECS service.ec2:spot-fleet-request:TargetCapacity
- The target capacity of a Spot Fleet request.elasticmapreduce:instancegroup:InstanceCount
- The instance count of an EMR Instance Group.appstream:fleet:DesiredCapacity
- The desired capacity of an AppStream 2.0 fleet.dynamodb:table:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB table.dynamodb:table:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB table.dynamodb:index:ReadCapacityUnits
- The provisioned read capacity for a DynamoDB global secondary index.dynamodb:index:WriteCapacityUnits
- The provisioned write capacity for a DynamoDB global secondary index.rds:cluster:ReadReplicaCount
- The count of Aurora Replicas in an Aurora DB cluster. Available for Aurora MySQL-compatible edition and Aurora PostgreSQL-compatible edition.sagemaker:variant:DesiredInstanceCount
- The number of EC2 instances for an Amazon SageMaker model endpoint variant.custom-resource:ResourceType:Property
- The scalable dimension for a custom resource provided by your own application or service.comprehend:document-classifier-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend document classification endpoint.comprehend:entity-recognizer-endpoint:DesiredInferenceUnits
- The number of inference units for an Amazon Comprehend entity recognizer endpoint.lambda:function:ProvisionedConcurrency
- The provisioned concurrency for a Lambda function.cassandra:table:ReadCapacityUnits
- The provisioned read capacity for an Amazon Keyspaces table.cassandra:table:WriteCapacityUnits
- The provisioned write capacity for an Amazon Keyspaces table.kafka:broker-storage:VolumeSize
- The provisioned volume size (in GiB) for brokers in an Amazon MSK cluster.
-
:min_capacity
(Integer)
—
The minimum value that you plan to scale in to. When a scaling policy is in effect, Application Auto Scaling can scale in (contract) as needed to the minimum capacity limit in response to changing demand.
This parameter is required if you are registering a scalable target. For certain resources, the minimum value allowed is 0. This includes Lambda provisioned concurrency, Spot Fleet, ECS services, Aurora DB clusters, EMR clusters, and custom resources. For all other resources, the minimum value allowed is 1.
-
:max_capacity
(Integer)
—
The maximum value that you plan to scale out to. When a scaling policy is in effect, Application Auto Scaling can scale out (expand) as needed to the maximum capacity limit in response to changing demand.
This parameter is required if you are registering a scalable target.
Although you can specify a large maximum capacity, note that service quotas may impose lower limits. Each service has its own default quotas for the maximum capacity of the resource. If you want to specify a higher limit, you can request an increase. For more information, consult the documentation for that service. For information about the default quotas for each service, see Service Endpoints and Quotas in the Amazon Web Services General Reference.
-
:role_arn
(String)
—
This parameter is required for services that do not support service-linked roles (such as Amazon EMR), and it must specify the ARN of an IAM role that allows Application Auto Scaling to modify the scalable target on your behalf.
If the service supports service-linked roles, Application Auto Scaling uses a service-linked role, which it creates if it does not yet exist. For more information, see Application Auto Scaling IAM Roles.
-
:suspended_state
(Types::SuspendedState)
—
An embedded object that contains attributes and attribute values that are used to suspend and resume automatic scaling. Setting the value of an attribute to
true
suspends the specified scaling activities. Setting it tofalse
(default) resumes the specified scaling activities.Suspension Outcomes
For
DynamicScalingInSuspended
, while a suspension is in effect, all scale-in activities that are triggered by a scaling policy are suspended.For
DynamicScalingOutSuspended
, while a suspension is in effect, all scale-out activities that are triggered by a scaling policy are suspended.For
ScheduledScalingSuspended
, while a suspension is in effect, all scaling activities that involve scheduled actions are suspended.
For more information, see Suspending and Resuming Scaling in the Application Auto Scaling User Guide.
Returns:
-
(Struct)
—
Returns an empty response.
See Also:
#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean
Waiters polls an API operation until a resource enters a desired state.
Basic Usage
Waiters will poll until they are succesful, they fail by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop, sleeping between attempts client.waiter_until(waiter_name, params)
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You configure waiters by passing a block to #wait_until:
# poll for ~25 seconds
client.wait_until(...) do |w|
w.max_attempts = 5
w.delay = 5
end
Callbacks
You can be notified before each polling attempt and before each
delay. If you throw :success
or :failure
from these callbacks,
it will terminate the waiter.
started_at = Time.now
client.wait_until(...) do |w|
# disable max attempts
w.max_attempts = nil
# poll for 1 hour, instead of a number of attempts
w.before_wait do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
end
Handling Errors
When a waiter is successful, it returns true
. When a waiter
fails, it raises an error. All errors raised extend from
Waiters::Errors::WaiterFailed.
begin
client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
Parameters:
-
waiter_name
(Symbol)
—
The name of the waiter. See #waiter_names for a full list of supported waiters.
-
params
(Hash)
(defaults to: {})
—
Additional request parameters. See the #waiter_names for a list of supported waiters and what request they call. The called request determines the list of accepted parameters.
Yield Parameters:
-
waiter
(Waiters::Waiter)
—
Yields a Waiter object that can be configured prior to waiting.
Returns:
-
(Boolean)
—
Returns
true
if the waiter was successful.
Raises:
-
(Errors::FailureStateError)
—
Raised when the waiter terminates because the waiter has entered a state that it will not transition out of, preventing success.
-
(Errors::TooManyAttemptsError)
—
Raised when the configured maximum number of attempts have been made, and the waiter is not yet successful.
-
(Errors::UnexpectedError)
—
Raised when an error is encounted while polling for a resource that is not expected.
-
(Errors::NoSuchWaiterError)
—
Raised when you request to wait for an unknown state.
#waiter_names ⇒ Array<Symbol>
Returns the list of supported waiters. The following table lists the supported waiters and the client method they call:
Waiter Name | Client Method | Default Delay: | Default Max Attempts: |
---|
Returns:
-
(Array<Symbol>)
—
the list of supported waiters.