CfnTargetGroup
- class aws_cdk.aws_vpclattice.CfnTargetGroup(scope, id, *, type, config=None, name=None, tags=None, targets=None)
Bases:
CfnResource
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 .
- See:
- CloudformationResource:
AWS::VpcLattice::TargetGroup
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_vpclattice as vpclattice cfn_target_group = vpclattice.CfnTargetGroup(self, "MyCfnTargetGroup", type="type", # the properties below are optional config=vpclattice.CfnTargetGroup.TargetGroupConfigProperty( health_check=vpclattice.CfnTargetGroup.HealthCheckConfigProperty( enabled=False, health_check_interval_seconds=123, health_check_timeout_seconds=123, healthy_threshold_count=123, matcher=vpclattice.CfnTargetGroup.MatcherProperty( http_code="httpCode" ), path="path", port=123, protocol="protocol", protocol_version="protocolVersion", unhealthy_threshold_count=123 ), ip_address_type="ipAddressType", lambda_event_structure_version="lambdaEventStructureVersion", port=123, protocol="protocol", protocol_version="protocolVersion", vpc_identifier="vpcIdentifier" ), name="name", tags=[CfnTag( key="key", value="value" )], targets=[vpclattice.CfnTargetGroup.TargetProperty( id="id", # the properties below are optional port=123 )] )
- Parameters:
scope (
Construct
) – Scope in which this resource is defined.id (
str
) – Construct identifier for this resource (unique in its scope).type (
str
) – The type of target group.config (
Union
[IResolvable
,TargetGroupConfigProperty
,Dict
[str
,Any
],None
]) – The target group configuration.name (
Optional
[str
]) – The name of the target group. The name must be unique within the account. The valid characters are a-z, 0-9, and hyphens (-). You can’t use a hyphen as the first or last character, or immediately after another hyphen. If you don’t specify a name, CloudFormation generates one. However, if you specify a name, and later want to replace the resource, you must specify a new name.tags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – The tags for the target group.targets (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,TargetProperty
,Dict
[str
,Any
]]],None
]) – Describes a target.
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_dependency(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- add_depends_on(target)
(deprecated) Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
- Parameters:
target (
CfnResource
) –- Deprecated:
use addDependency
- Stability:
deprecated
- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –value (
Any
) –
- See:
- Return type:
None
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT
). A list of resources that support this policy can be found in the following link:- Parameters:
policy (
Optional
[RemovalPolicy
]) –apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resource, please consult that specific resource’s documentation.
- See:
- Return type:
None
- get_att(attribute_name, type_hint=None)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.type_hint (
Optional
[ResolutionTypeHint
]) –
- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –- See:
- Return type:
Any
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) – tree inspector to collect and process attributes.- Return type:
None
- obtain_dependencies()
Retrieves an array of resources this resource depends on.
This assembles dependencies on resources across stacks (including nested stacks) automatically.
- Return type:
List
[Union
[Stack
,CfnResource
]]
- obtain_resource_dependencies()
Get a shallow copy of dependencies between this resource and other resources in the same stack.
- Return type:
List
[CfnResource
]
- override_logical_id(new_logical_id)
Overrides the auto-generated logical ID with a specific ID.
- Parameters:
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type:
None
- remove_dependency(target)
Indicates that this resource no longer depends on another resource.
This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- replace_dependency(target, new_target)
Replaces one dependency with another.
- Parameters:
target (
CfnResource
) – The dependency to replace.new_target (
CfnResource
) – The new dependency to add.
- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::VpcLattice::TargetGroup'
- attr_arn
The Amazon Resource Name (ARN) of the target group.
- CloudformationAttribute:
Arn
- attr_created_at
The date and time that the target group was created, specified in ISO-8601 format.
- CloudformationAttribute:
CreatedAt
- attr_id
The ID of the target group.
- CloudformationAttribute:
Id
- attr_last_updated_at
The date and time that the target group was last updated, specified in ISO-8601 format.
- CloudformationAttribute:
LastUpdatedAt
- attr_status
The operation’s status.
You can retry the operation if the status is
CREATE_FAILED
. However, if you retry it while the status isCREATE_IN_PROGRESS
, there is no change in the status.- CloudformationAttribute:
Status
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- config
The target group configuration.
- creation_stack
return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- logical_id
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- name
The name of the target group.
- node
The tree node.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- tags
Tag Manager which manages the tags for this resource.
- tags_raw
The tags for the target group.
- targets
Describes a target.
- type
The type of target group.
Static Methods
- classmethod is_cfn_element(x)
Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters:
x (
Any
) –- Return type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(x)
Check whether the given object is a CfnResource.
- Parameters:
x (
Any
) –- Return type:
bool
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.
HealthCheckConfigProperty
- class CfnTargetGroup.HealthCheckConfigProperty(*, enabled=None, health_check_interval_seconds=None, health_check_timeout_seconds=None, healthy_threshold_count=None, matcher=None, path=None, port=None, protocol=None, protocol_version=None, unhealthy_threshold_count=None)
Bases:
object
Describes the health check configuration of a target group.
Health check configurations aren’t used for target groups of type
LAMBDA
orALB
.- Parameters:
enabled (
Union
[bool
,IResolvable
,None
]) – Indicates whether health checking is enabled.health_check_interval_seconds (
Union
[int
,float
,None
]) – The approximate amount of time, in seconds, between health checks of an individual target. The range is 5–300 seconds. The default is 30 seconds.health_check_timeout_seconds (
Union
[int
,float
,None
]) – The amount of time, in seconds, to wait before reporting a target as unhealthy. The range is 1–120 seconds. The default is 5 seconds.healthy_threshold_count (
Union
[int
,float
,None
]) – The number of consecutive successful health checks required before considering an unhealthy target healthy. The range is 2–10. The default is 5.matcher (
Union
[IResolvable
,MatcherProperty
,Dict
[str
,Any
],None
]) – The codes to use when checking for a successful response from a target.path (
Optional
[str
]) – The destination for health checks on the targets. If the protocol version isHTTP/1.1
orHTTP/2
, specify a valid URI (for example,/path?query
). The default path is/
. Health checks are not supported if the protocol version isgRPC
, however, you can chooseHTTP/1.1
orHTTP/2
and specify a valid URI.port (
Union
[int
,float
,None
]) – The port used when performing health checks on targets. The default setting is the port that a target receives traffic on.protocol (
Optional
[str
]) – The protocol used when performing health checks on targets. The possible protocols areHTTP
andHTTPS
. The default isHTTP
.protocol_version (
Optional
[str
]) – The protocol version used when performing health checks on targets. The possible protocol versions areHTTP1
andHTTP2
.unhealthy_threshold_count (
Union
[int
,float
,None
]) – The number of consecutive failed health checks required before considering a target unhealthy. The range is 2–10. The default is 2.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_vpclattice as vpclattice health_check_config_property = vpclattice.CfnTargetGroup.HealthCheckConfigProperty( enabled=False, health_check_interval_seconds=123, health_check_timeout_seconds=123, healthy_threshold_count=123, matcher=vpclattice.CfnTargetGroup.MatcherProperty( http_code="httpCode" ), path="path", port=123, protocol="protocol", protocol_version="protocolVersion", unhealthy_threshold_count=123 )
Attributes
- enabled
Indicates whether health checking is enabled.
- health_check_interval_seconds
The approximate amount of time, in seconds, between health checks of an individual target.
The range is 5–300 seconds. The default is 30 seconds.
- health_check_timeout_seconds
The amount of time, in seconds, to wait before reporting a target as unhealthy.
The range is 1–120 seconds. The default is 5 seconds.
- healthy_threshold_count
The number of consecutive successful health checks required before considering an unhealthy target healthy.
The range is 2–10. The default is 5.
- matcher
The codes to use when checking for a successful response from a target.
- path
The destination for health checks on the targets.
If the protocol version is
HTTP/1.1
orHTTP/2
, specify a valid URI (for example,/path?query
). The default path is/
. Health checks are not supported if the protocol version isgRPC
, however, you can chooseHTTP/1.1
orHTTP/2
and specify a valid URI.
- port
The port used when performing health checks on targets.
The default setting is the port that a target receives traffic on.
- protocol
The protocol used when performing health checks on targets.
The possible protocols are
HTTP
andHTTPS
. The default isHTTP
.
- protocol_version
The protocol version used when performing health checks on targets.
The possible protocol versions are
HTTP1
andHTTP2
.
- unhealthy_threshold_count
The number of consecutive failed health checks required before considering a target unhealthy.
The range is 2–10. The default is 2.
MatcherProperty
- class CfnTargetGroup.MatcherProperty(*, http_code)
Bases:
object
Describes the codes to use when checking for a successful response from a target for health checks.
- Parameters:
http_code (
str
) – The HTTP code to use when checking for a successful response from a target.- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_vpclattice as vpclattice matcher_property = vpclattice.CfnTargetGroup.MatcherProperty( http_code="httpCode" )
Attributes
- http_code
The HTTP code to use when checking for a successful response from a target.
TargetGroupConfigProperty
- class CfnTargetGroup.TargetGroupConfigProperty(*, health_check=None, ip_address_type=None, lambda_event_structure_version=None, port=None, protocol=None, protocol_version=None, vpc_identifier=None)
Bases:
object
Describes the configuration of a target group.
For more information, see Target groups in the Amazon VPC Lattice User Guide .
- Parameters:
health_check (
Union
[IResolvable
,HealthCheckConfigProperty
,Dict
[str
,Any
],None
]) – The health check configuration. Not supported if the target group type isLAMBDA
orALB
.ip_address_type (
Optional
[str
]) – The type of IP address used for the target group. Supported only if the target group type isIP
. The default isIPV4
. Default: - “IPV4”lambda_event_structure_version (
Optional
[str
]) – The version of the event structure that your Lambda function receives. Supported only if the target group type isLAMBDA
. The default isV1
.port (
Union
[int
,float
,None
]) – The port on which the targets are listening. For HTTP, the default is 80. For HTTPS, the default is 443. Not supported if the target group type isLAMBDA
.protocol (
Optional
[str
]) – The protocol to use for routing traffic to the targets. The default is the protocol of the target group. Not supported if the target group type isLAMBDA
.protocol_version (
Optional
[str
]) – The protocol version. The default isHTTP1
. Not supported if the target group type isLAMBDA
. Default: - “HTTP1”vpc_identifier (
Optional
[str
]) – The ID of the VPC. Not supported if the target group type isLAMBDA
.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_vpclattice as vpclattice target_group_config_property = vpclattice.CfnTargetGroup.TargetGroupConfigProperty( health_check=vpclattice.CfnTargetGroup.HealthCheckConfigProperty( enabled=False, health_check_interval_seconds=123, health_check_timeout_seconds=123, healthy_threshold_count=123, matcher=vpclattice.CfnTargetGroup.MatcherProperty( http_code="httpCode" ), path="path", port=123, protocol="protocol", protocol_version="protocolVersion", unhealthy_threshold_count=123 ), ip_address_type="ipAddressType", lambda_event_structure_version="lambdaEventStructureVersion", port=123, protocol="protocol", protocol_version="protocolVersion", vpc_identifier="vpcIdentifier" )
Attributes
- health_check
The health check configuration.
Not supported if the target group type is
LAMBDA
orALB
.
- ip_address_type
The type of IP address used for the target group.
Supported only if the target group type is
IP
. The default isIPV4
.
- lambda_event_structure_version
The version of the event structure that your Lambda function receives.
Supported only if the target group type is
LAMBDA
. The default isV1
.
- port
The port on which the targets are listening.
For HTTP, the default is 80. For HTTPS, the default is 443. Not supported if the target group type is
LAMBDA
.
- protocol
The protocol to use for routing traffic to the targets.
The default is the protocol of the target group. Not supported if the target group type is
LAMBDA
.
- protocol_version
The protocol version.
The default is
HTTP1
. Not supported if the target group type isLAMBDA
.
- vpc_identifier
The ID of the VPC.
Not supported if the target group type is
LAMBDA
.
TargetProperty
- class CfnTargetGroup.TargetProperty(*, id, port=None)
Bases:
object
Describes a target.
- Parameters:
id (
str
) – The ID of the target. If the target group type isINSTANCE
, this is an instance ID. If the target group type isIP
, this is an IP address. If the target group type isLAMBDA
, this is the ARN of a Lambda function. If the target group type isALB
, this is the ARN of an Application Load Balancer.port (
Union
[int
,float
,None
]) – The port on which the target is listening. For HTTP, the default is 80. For HTTPS, the default is 443.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_vpclattice as vpclattice target_property = vpclattice.CfnTargetGroup.TargetProperty( id="id", # the properties below are optional port=123 )
Attributes
- id
The ID of the target.
If the target group type is
INSTANCE
, this is an instance ID. If the target group type isIP
, this is an IP address. If the target group type isLAMBDA
, this is the ARN of a Lambda function. If the target group type isALB
, this is the ARN of an Application Load Balancer.
- port
The port on which the target is listening.
For HTTP, the default is 80. For HTTPS, the default is 443.