Skip to main content

target_groups

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

Overview

Nametarget_groups
TypeResource
Idaws.vpc_lattice.target_groups

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe ID of the target group. (pattern: <code>tg-[0-9a-z]{17}</code>)
namestringThe name of the target group. (pattern: <code>(?!tg-)(?![-])(?!.[-]$)(?!.[-]{2})[a-z0-9-]+</code>)
arnstringThe Amazon Resource Name (ARN) of the target group. (pattern: <code>arn:[a-z0-9-]+:vpc-lattice:[a-zA-Z0-9-]+:\d{12}:targetgroup/tg-[0-9a-z]{17}</code>)
configobjectDescribes the configuration of a target group. For more information, see Target groups in the Amazon VPC Lattice User Guide.
created_atstring (date-time)The date and time that the target group was created, in ISO-8601 format.
failure_codestringThe failure code.
failure_messagestringThe failure message.
last_updated_atstring (date-time)The date and time that the target group was last updated, in ISO-8601 format.
service_arnsarrayThe Amazon Resource Names (ARNs) of the service.
statusstringThe status. (CREATE_IN_PROGRESS, ACTIVE, DELETE_IN_PROGRESS, CREATE_FAILED, DELETE_FAILED)
type_stringThe target group type. (IP, LAMBDA, INSTANCE, ALB)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_target_groupselecttarget_group_identifier, regionRetrieves information about the specified target group.
list_target_groupsselectregionmaxResults, nextToken, vpcIdentifier, targetGroupTypeLists your target groups. You can narrow your search by using the filters below in your request.
create_target_groupinsertregion, name, typeCreates a target group. A target group is a collection of targets, or compute resources, that run your application or service. A target group can only be used by a single service. For more information, see Target groups in the Amazon VPC Lattice User Guide.
update_target_groupupdatetarget_group_identifier, region, healthCheckUpdates the specified target group.
delete_target_groupdeletetarget_group_identifier, regionDeletes a target group. You can't delete a target group if it is used in a listener rule or if the target group creation is in progress.

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.
targetGroupTypestringThe target group type.
vpcIdentifierstringThe ID or ARN of the VPC.

SELECT examples

Retrieves information about the specified target group.

SELECT
id,
name,
arn,
config,
created_at,
failure_code,
failure_message,
last_updated_at,
service_arns,
status,
type_
FROM aws.vpc_lattice.target_groups
WHERE target_group_identifier = '{{ target_group_identifier }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a target group. A target group is a collection of targets, or compute resources, that run your application or service. A target group can only be used by a single service. For more information, see Target groups in the Amazon VPC Lattice User Guide.

INSERT INTO aws.vpc_lattice.target_groups (
name,
type,
config,
clientToken,
tags,
region
)
SELECT
'{{ name }}' /* required */,
'{{ type }}' /* required */,
'{{ config }}',
'{{ clientToken }}',
'{{ tags }}',
'{{ region }}'
RETURNING
id,
name,
arn,
config,
status,
type_
;

UPDATE examples

Updates the specified target group.

UPDATE aws.vpc_lattice.target_groups
SET
healthCheck = '{{ healthCheck }}'
WHERE
target_group_identifier = '{{ target_group_identifier }}' --required
AND region = '{{ region }}' --required
AND healthCheck = '{{ healthCheck }}' --required
RETURNING
id,
name,
arn,
config,
status,
type_;

DELETE examples

Deletes a target group. You can't delete a target group if it is used in a listener rule or if the target group creation is in progress.

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