target_groups
Creates, updates, deletes or gets a target_group resource or lists target_groups in a region
Overview
| Name | target_groups |
| Type | Resource |
| Description | 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. |
| Id | awscc.vpclattice.target_groups |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
arn | string | |
config | object | |
created_at | string | |
id | string | |
last_updated_at | string | |
name | string | |
status | string | |
type | string | |
targets | array | |
tags | array | |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
arn | string | |
region | string | AWS region. |
For more information, see AWS::VpcLattice::TargetGroup.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | target_groups | INSERT | Type, region |
delete_resource | target_groups | DELETE | Identifier, region |
update_resource | target_groups | UPDATE | Identifier, PatchDocument, region |
list_resources | target_groups_list_only | SELECT | region |
get_resource | target_groups | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual target_group.
SELECT
region,
arn,
config,
created_at,
id,
last_updated_at,
name,
status,
type,
targets,
tags
FROM awscc.vpclattice.target_groups
WHERE
region = '{{ region }}' AND
Identifier = '{{ arn }}';
Lists all target_groups in a region.
SELECT
region,
arn
FROM awscc.vpclattice.target_groups_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new target_group resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.vpclattice.target_groups (
Type,
region
)
SELECT
'{{ type }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.vpclattice.target_groups (
Config,
Name,
Type,
Targets,
Tags,
region
)
SELECT
'{{ config }}',
'{{ name }}',
'{{ type }}',
'{{ targets }}',
'{{ tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: target_group
props:
- name: config
value:
port: '{{ port }}'
protocol: '{{ protocol }}'
protocol_version: '{{ protocol_version }}'
ip_address_type: '{{ ip_address_type }}'
lambda_event_structure_version: '{{ lambda_event_structure_version }}'
vpc_identifier: '{{ vpc_identifier }}'
health_check:
enabled: '{{ enabled }}'
protocol: '{{ protocol }}'
protocol_version: '{{ protocol_version }}'
port: '{{ port }}'
path: '{{ path }}'
health_check_interval_seconds: '{{ health_check_interval_seconds }}'
health_check_timeout_seconds: '{{ health_check_timeout_seconds }}'
healthy_threshold_count: '{{ healthy_threshold_count }}'
unhealthy_threshold_count: '{{ unhealthy_threshold_count }}'
matcher:
http_code: '{{ http_code }}'
- name: name
value: '{{ name }}'
- name: type
value: '{{ type }}'
- name: targets
value:
- id: '{{ id }}'
port: '{{ port }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
UPDATE example
Use the following StackQL query and manifest file to update a target_group resource, using stack-deploy.
/*+ update */
UPDATE awscc.vpclattice.target_groups
SET PatchDocument = string('{{ {
"Targets": targets,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ arn }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.vpclattice.target_groups
WHERE
Identifier = '{{ arn }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the target_groups resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
vpc-lattice:CreateTargetGroup,
vpc-lattice:GetTargetGroup,
vpc-lattice:RegisterTargets,
vpc-lattice:ListTargets,
vpc-lattice:ListTagsForResource,
vpc-lattice:TagResource,
vpc-lattice:UntagResource,
ec2:DescribeVpcs,
ec2:DescribeInstances,
ec2:DescribeSubnets,
ec2:DescribeAvailabilityZoneMappings,
lambda:Invoke,
lambda:AddPermission,
elasticloadbalancing:DescribeLoadBalancers,
iam:CreateServiceLinkedRole
vpc-lattice:GetTargetGroup,
vpc-lattice:ListTargets,
vpc-lattice:ListTagsForResource
vpc-lattice:UpdateTargetGroup,
vpc-lattice:GetTargetGroup,
vpc-lattice:ListTargets,
vpc-lattice:RegisterTargets,
vpc-lattice:DeregisterTargets,
ec2:DescribeVpcs,
ec2:DescribeInstances,
ec2:DescribeSubnets,
ec2:DescribeAvailabilityZoneMappings,
elasticloadbalancing:DescribeLoadBalancers,
lambda:Invoke,
lambda:RemovePermission,
lambda:AddPermission,
vpc-lattice:TagResource,
vpc-lattice:UntagResource,
vpc-lattice:ListTagsForResource
vpc-lattice:DeleteTargetGroup,
vpc-lattice:GetTargetGroup,
vpc-lattice:DeregisterTargets,
vpc-lattice:ListTargets,
lambda:RemovePermission
vpc-lattice:ListTargetGroups