Skip to main content

targets

Creates, updates, deletes, gets or lists a targets resource.

Overview

Nametargets
TypeResource
Idaws.vpc_lattice.targets

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe ID of the target. If the target group type is INSTANCE, this is an instance ID. If the target group type is IP, this is an IP address. If the target group type is LAMBDA, this is the ARN of a Lambda function. If the target type is ALB, this is the ARN of an Application Load Balancer.
portintegerThe port on which the target is listening.
reason_codestringThe code for why the target status is what it is.
statusstringThe status of the target. DRAINING: The target is being deregistered. No new connections are sent to this target while current connections are being drained. The default draining time is 1 minute. UNAVAILABLE: Health checks are unavailable for the target group. HEALTHY: The target is healthy. UNHEALTHY: The target is unhealthy. INITIAL: Initial health checks on the target are being performed. UNUSED: Target group is not used in a service. (DRAINING, UNAVAILABLE, HEALTHY, UNHEALTHY, INITIAL, UNUSED)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_targetsselecttarget_group_identifier, regionmaxResults, nextTokenLists the targets for the target group. By default, all targets are included. You can use this API to check the health status of targets. You can also filter the results by target.
register_targetsinserttarget_group_identifier, region, targetsRegisters the targets with the target group. If it's a Lambda target, you can only have one target in a target group.
deregister_targetsdeletetarget_group_identifier, regionDeregisters the specified targets from the specified target group.

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.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)
target_group_identifierstringThe ID or ARN of the target group.
maxResultsintegerThe maximum number of results to return.
nextTokenstringA pagination token for the next page of results.

SELECT examples

Lists the targets for the target group. By default, all targets are included. You can use this API to check the health status of targets. You can also filter the results by target.

SELECT
id,
port,
reason_code,
status
FROM aws.vpc_lattice.targets
WHERE target_group_identifier = '{{ target_group_identifier }}' -- required
AND region = '{{ region }}' -- required
AND maxResults = '{{ maxResults }}'
AND nextToken = '{{ nextToken }}'
;

INSERT examples

Registers the targets with the target group. If it's a Lambda target, you can only have one target in a target group.

INSERT INTO aws.vpc_lattice.targets (
targets,
target_group_identifier,
region
)
SELECT
'{{ targets }}' /* required */,
'{{ target_group_identifier }}',
'{{ region }}'
RETURNING
successful,
unsuccessful
;

DELETE examples

Deregisters the specified targets from the specified target group.

DELETE FROM aws.vpc_lattice.targets
WHERE target_group_identifier = '{{ target_group_identifier }}' --required
AND region = '{{ region }}' --required
;