traffic_sources
Creates, updates, deletes, gets or lists a traffic_sources resource.
Overview
| Name | traffic_sources |
| Type | Resource |
| Id | aws.autoscaling.traffic_sources |
Fields
The following fields are returned by SELECT queries:
- describe_traffic_sources
| Name | Datatype | Description |
|---|---|---|
identifier | string | The unique identifier of the traffic source. |
state | string | Describes the current state of a traffic source. The state values are as follows: Adding - The Auto Scaling instances are being registered with the load balancer or target group. Added - All Auto Scaling instances are registered with the load balancer or target group. InService - For an Elastic Load Balancing load balancer or target group, at least one Auto Scaling instance passed an ELB health check. For VPC Lattice, at least one Auto Scaling instance passed an VPC_LATTICE health check. Removing - The Auto Scaling instances are being deregistered from the load balancer or target group. If connection draining (deregistration delay) is enabled, Elastic Load Balancing or VPC Lattice waits for in-flight requests to complete before deregistering the instances. Removed - All Auto Scaling instances are deregistered from the load balancer or target group. |
traffic_source | string | This is replaced by Identifier. |
type | string | Provides additional context for the value of Identifier. The following lists the valid values: elb if Identifier is the name of a Classic Load Balancer. elbv2 if Identifier is the ARN of an Application Load Balancer, Gateway Load Balancer, or Network Load Balancer target group. vpc-lattice if Identifier is the ARN of a VPC Lattice target group. Required if the identifier is the name of a Classic Load Balancer. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_traffic_sources | select | AutoScalingGroupName, region | TrafficSourceType, NextToken, MaxRecords | Gets information about the traffic sources for the specified Auto Scaling group. You can optionally provide a traffic source type. If you provide a traffic source type, then the results only include that traffic source type. If you do not provide a traffic source type, then the results include all the traffic sources for the specified Auto Scaling group. |
attach_traffic_sources | update | AutoScalingGroupName, TrafficSources, region | SkipZonalShiftValidation | Attaches one or more traffic sources to the specified Auto Scaling group. You can use any of the following as traffic sources for an Auto Scaling group: Application Load Balancer Classic Load Balancer Gateway Load Balancer Network Load Balancer VPC Lattice This operation is additive and does not detach existing traffic sources from the Auto Scaling group. After the operation completes, use the DescribeTrafficSources API to return details about the state of the attachments between traffic sources and your Auto Scaling group. To detach a traffic source from the Auto Scaling group, call the DetachTrafficSources API. |
detach_traffic_sources | exec | AutoScalingGroupName, TrafficSources, region | Detaches one or more traffic sources from the specified Auto Scaling group. When you detach a traffic source, it enters the Removing state while deregistering the instances in the group. When all instances are deregistered, then you can no longer describe the traffic source using the DescribeTrafficSources API call. The instances continue to run. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
AutoScalingGroupName | string | The name of the Auto Scaling group. |
TrafficSources | array | The unique identifiers of one or more traffic sources. You can specify up to 10 traffic sources. |
region | string | AWS region (default: us-east-1) |
MaxRecords | integer | The maximum number of items to return with this call. The maximum value is 50. |
NextToken | string | The token for the next set of items to return. (You received this token from a previous call.) |
SkipZonalShiftValidation | boolean | If you enable zonal shift with cross-zone disabled load balancers, capacity could become imbalanced across Availability Zones. To skip the validation, specify true. For more information, see Auto Scaling group zonal shift in the Amazon EC2 Auto Scaling User Guide. |
TrafficSourceType | string | The traffic source type that you want to describe. The following lists the valid values: elb if the traffic source is a Classic Load Balancer. elbv2 if the traffic source is a Application Load Balancer, Gateway Load Balancer, or Network Load Balancer. vpc-lattice if the traffic source is VPC Lattice. |
SELECT examples
- describe_traffic_sources
Gets information about the traffic sources for the specified Auto Scaling group. You can optionally provide a traffic source type. If you provide a traffic source type, then the results only include that traffic source type. If you do not provide a traffic source type, then the results include all the traffic sources for the specified Auto Scaling group.
SELECT
identifier,
state,
traffic_source,
type
FROM aws.autoscaling.traffic_sources
WHERE AutoScalingGroupName = '{{ AutoScalingGroupName }}' -- required
AND region = '{{ region }}' -- required
AND TrafficSourceType = '{{ TrafficSourceType }}'
AND NextToken = '{{ NextToken }}'
AND MaxRecords = '{{ MaxRecords }}'
;
UPDATE examples
- attach_traffic_sources
Attaches one or more traffic sources to the specified Auto Scaling group. You can use any of the following as traffic sources for an Auto Scaling group: Application Load Balancer Classic Load Balancer Gateway Load Balancer Network Load Balancer VPC Lattice This operation is additive and does not detach existing traffic sources from the Auto Scaling group. After the operation completes, use the DescribeTrafficSources API to return details about the state of the attachments between traffic sources and your Auto Scaling group. To detach a traffic source from the Auto Scaling group, call the DetachTrafficSources API.
UPDATE aws.autoscaling.traffic_sources
SET
-- No updatable properties
WHERE
AutoScalingGroupName = '{{ AutoScalingGroupName }}' --required
AND TrafficSources = '{{ TrafficSources }}' --required
AND region = '{{ region }}' --required
AND SkipZonalShiftValidation = {{ SkipZonalShiftValidation}};
Lifecycle Methods
- detach_traffic_sources
Detaches one or more traffic sources from the specified Auto Scaling group. When you detach a traffic source, it enters the Removing state while deregistering the instances in the group. When all instances are deregistered, then you can no longer describe the traffic source using the DescribeTrafficSources API call. The instances continue to run.
EXEC aws.autoscaling.traffic_sources.detach_traffic_sources
@AutoScalingGroupName='{{ AutoScalingGroupName }}' --required,
@TrafficSources='{{ TrafficSources }}' --required,
@region='{{ region }}' --required
;