CfnTargetGroup

class aws_cdk.aws_vpclattice.CfnTargetGroup(scope, id, *, type, config=None, name=None, tags=None, targets=None)

Bases: CfnResource

A CloudFormation AWS::VpcLattice::TargetGroup.

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 .

CloudformationResource:

AWS::VpcLattice::TargetGroup

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-vpclattice-targetgroup.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_vpclattice as vpclattice

cfn_target_group = vpclattice.CfnTargetGroup(self, "MyCfnTargetGroup",
    type="type",

    # the properties below are optional
    config=vpclattice.CfnTargetGroup.TargetGroupConfigProperty(
        port=123,
        protocol="protocol",
        vpc_identifier="vpcIdentifier",

        # the properties below are optional
        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",
        protocol_version="protocolVersion"
    ),
    name="name",
    tags=[CfnTag(
        key="key",
        value="value"
    )],
    targets=[vpclattice.CfnTargetGroup.TargetProperty(
        id="id",

        # the properties below are optional
        port=123
    )]
)

Create a new AWS::VpcLattice::TargetGroup.

Parameters:
  • scope (Construct) –

    • scope in which this resource is defined.

  • id (str) –

    • scoped id of the resource.

  • type (str) – The type of target group.

  • config (Union[IResolvable, TargetGroupConfigProperty, Dict[str, Any], None]) – The target group configuration. If type is set to LAMBDA , this parameter doesn’t apply.

  • 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_depends_on(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_metadata(key, value)

Add a value to the CloudFormation Resource Metadata.

Parameters:
  • key (str) –

  • value (Any) –

See:

Return type:

None

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

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 prefix path 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 to addOverride 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 intermdediate 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).

Parameters:
  • policy (Optional[RemovalPolicy]) –

  • apply_to_update_replace_policy (Optional[bool]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: true

  • default (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 resoure, please consult that specific resource’s documentation.

Return type:

None

get_att(attribute_name)

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.

Return type:

Reference

get_metadata(key)

Retrieve a value value from the CloudFormation Resource Metadata.

Parameters:

key (str) –

See:

Return type:

Any

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

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

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

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 is CREATE_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.

If type is set to LAMBDA , this parameter doesn’t apply.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-vpclattice-targetgroup.html#cfn-vpclattice-targetgroup-config

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.

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.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-vpclattice-targetgroup.html#cfn-vpclattice-targetgroup-name

node

The construct tree node associated with this construct.

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

The tags for the target group.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-vpclattice-targetgroup.html#cfn-vpclattice-targetgroup-tags

targets

Describes a target.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-vpclattice-targetgroup.html#cfn-vpclattice-targetgroup-targets

type

The type of target group.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-vpclattice-targetgroup.html#cfn-vpclattice-targetgroup-type

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(construct)

Check whether the given construct is a CfnResource.

Parameters:

construct (IConstruct) –

Return type:

bool

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters:

x (Any) –

Return type:

bool

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

The health check configuration of a target group.

Health check configurations aren’t used for LAMBDA and ALB target groups.

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. These are called Success codes in the console.

  • path (Optional[str]) – The destination for health checks on the targets. If the protocol version is HTTP/1.1 or HTTP/2 , specify a valid URI (for example, /path?query ). The default path is / . Health checks are not supported if the protocol version is gRPC , however, you can choose HTTP/1.1 or HTTP/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 are HTTP and HTTPS . The default is HTTP .

  • protocol_version (Optional[str]) – The protocol version used when performing health checks on targets. The possible protocol versions are HTTP1 and HTTP2 .

  • 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.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-healthcheckconfig.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.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.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-healthcheckconfig.html#cfn-vpclattice-targetgroup-healthcheckconfig-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.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-healthcheckconfig.html#cfn-vpclattice-targetgroup-healthcheckconfig-healthcheckintervalseconds

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.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-healthcheckconfig.html#cfn-vpclattice-targetgroup-healthcheckconfig-healthchecktimeoutseconds

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.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-healthcheckconfig.html#cfn-vpclattice-targetgroup-healthcheckconfig-healthythresholdcount

matcher

The codes to use when checking for a successful response from a target.

These are called Success codes in the console.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-healthcheckconfig.html#cfn-vpclattice-targetgroup-healthcheckconfig-matcher

path

The destination for health checks on the targets.

If the protocol version is HTTP/1.1 or HTTP/2 , specify a valid URI (for example, /path?query ). The default path is / . Health checks are not supported if the protocol version is gRPC , however, you can choose HTTP/1.1 or HTTP/2 and specify a valid URI.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-healthcheckconfig.html#cfn-vpclattice-targetgroup-healthcheckconfig-path

port

The port used when performing health checks on targets.

The default setting is the port that a target receives traffic on.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-healthcheckconfig.html#cfn-vpclattice-targetgroup-healthcheckconfig-port

protocol

The protocol used when performing health checks on targets.

The possible protocols are HTTP and HTTPS . The default is HTTP .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-healthcheckconfig.html#cfn-vpclattice-targetgroup-healthcheckconfig-protocol

protocol_version

The protocol version used when performing health checks on targets.

The possible protocol versions are HTTP1 and HTTP2 .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-healthcheckconfig.html#cfn-vpclattice-targetgroup-healthcheckconfig-protocolversion

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.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-healthcheckconfig.html#cfn-vpclattice-targetgroup-healthcheckconfig-unhealthythresholdcount

MatcherProperty

class CfnTargetGroup.MatcherProperty(*, http_code)

Bases: object

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.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-matcher.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.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.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-matcher.html#cfn-vpclattice-targetgroup-matcher-httpcode

TargetGroupConfigProperty

class CfnTargetGroup.TargetGroupConfigProperty(*, port, protocol, vpc_identifier, health_check=None, ip_address_type=None, protocol_version=None)

Bases: object

Describes the configuration of a target group.

Lambda functions don’t support target group configuration.

Parameters:
  • port (Union[int, float]) – The port on which the targets are listening. For HTTP, the default is 80 . For HTTPS, the default is 443

  • protocol (str) – The protocol to use for routing traffic to the targets. Default is the protocol of a target group.

  • vpc_identifier (str) – The ID of the VPC.

  • health_check (Union[IResolvable, HealthCheckConfigProperty, Dict[str, Any], None]) – The health check configuration.

  • ip_address_type (Optional[str]) – The type of IP address used for the target group. The possible values are ipv4 and ipv6 . This is an optional parameter. If not specified, the IP address type defaults to ipv4 .

  • protocol_version (Optional[str]) – The protocol version. Default value is HTTP1 .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-targetgroupconfig.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_vpclattice as vpclattice

target_group_config_property = vpclattice.CfnTargetGroup.TargetGroupConfigProperty(
    port=123,
    protocol="protocol",
    vpc_identifier="vpcIdentifier",

    # the properties below are optional
    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",
    protocol_version="protocolVersion"
)

Attributes

health_check

The health check configuration.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-targetgroupconfig.html#cfn-vpclattice-targetgroup-targetgroupconfig-healthcheck

ip_address_type

The type of IP address used for the target group.

The possible values are ipv4 and ipv6 . This is an optional parameter. If not specified, the IP address type defaults to ipv4 .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-targetgroupconfig.html#cfn-vpclattice-targetgroup-targetgroupconfig-ipaddresstype

port

The port on which the targets are listening.

For HTTP, the default is 80 . For HTTPS, the default is 443

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-targetgroupconfig.html#cfn-vpclattice-targetgroup-targetgroupconfig-port

protocol

The protocol to use for routing traffic to the targets.

Default is the protocol of a target group.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-targetgroupconfig.html#cfn-vpclattice-targetgroup-targetgroupconfig-protocol

protocol_version

The protocol version.

Default value is HTTP1 .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-targetgroupconfig.html#cfn-vpclattice-targetgroup-targetgroupconfig-protocolversion

vpc_identifier

The ID of the VPC.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-targetgroupconfig.html#cfn-vpclattice-targetgroup-targetgroupconfig-vpcidentifier

TargetProperty

class CfnTargetGroup.TargetProperty(*, id, port=None)

Bases: object

Describes a target.

Parameters:
  • id (str) – The ID of the target. If the target type of the target group is INSTANCE , this is an instance ID. If the target type is IP , this is an IP address. If the target type is LAMBDA , this is the ARN of the Lambda function. If the target type is ALB , this is the ARN of the 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 .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-target.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.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 type of the target group is INSTANCE , this is an instance ID. If the target type is IP , this is an IP address. If the target type is LAMBDA , this is the ARN of the Lambda function. If the target type is ALB , this is the ARN of the Application Load Balancer.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-target.html#cfn-vpclattice-targetgroup-target-id

port

The port on which the target is listening.

For HTTP, the default is 80 . For HTTPS, the default is 443 .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-targetgroup-target.html#cfn-vpclattice-targetgroup-target-port