CfnTargetGroup

class aws_cdk.aws_elasticloadbalancingv2.CfnTargetGroup(scope, id, *, health_check_enabled=None, health_check_interval_seconds=None, health_check_path=None, health_check_port=None, health_check_protocol=None, health_check_timeout_seconds=None, healthy_threshold_count=None, ip_address_type=None, matcher=None, name=None, port=None, protocol=None, protocol_version=None, tags=None, target_group_attributes=None, targets=None, target_type=None, unhealthy_threshold_count=None, vpc_id=None)

Bases: aws_cdk.core.CfnResource

A CloudFormation AWS::ElasticLoadBalancingV2::TargetGroup.

CloudformationResource

AWS::ElasticLoadBalancingV2::TargetGroup

Link

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

Example:

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

cfn_target_group = elbv2.CfnTargetGroup(self, "MyCfnTargetGroup",
    health_check_enabled=False,
    health_check_interval_seconds=123,
    health_check_path="healthCheckPath",
    health_check_port="healthCheckPort",
    health_check_protocol="healthCheckProtocol",
    health_check_timeout_seconds=123,
    healthy_threshold_count=123,
    ip_address_type="ipAddressType",
    matcher=elbv2.CfnTargetGroup.MatcherProperty(
        grpc_code="grpcCode",
        http_code="httpCode"
    ),
    name="name",
    port=123,
    protocol="protocol",
    protocol_version="protocolVersion",
    tags=[CfnTag(
        key="key",
        value="value"
    )],
    target_group_attributes=[elbv2.CfnTargetGroup.TargetGroupAttributeProperty(
        key="key",
        value="value"
    )],
    targets=[elbv2.CfnTargetGroup.TargetDescriptionProperty(
        id="id",

        # the properties below are optional
        availability_zone="availabilityZone",
        port=123
    )],
    target_type="targetType",
    unhealthy_threshold_count=123,
    vpc_id="vpcId"
)

Create a new AWS::ElasticLoadBalancingV2::TargetGroup.

Parameters
  • scope (Construct) –

    • scope in which this resource is defined.

  • id (str) –

    • scoped id of the resource.

  • health_check_enabled (Union[bool, IResolvable, None]) – AWS::ElasticLoadBalancingV2::TargetGroup.HealthCheckEnabled.

  • health_check_interval_seconds (Union[int, float, None]) – AWS::ElasticLoadBalancingV2::TargetGroup.HealthCheckIntervalSeconds.

  • health_check_path (Optional[str]) – AWS::ElasticLoadBalancingV2::TargetGroup.HealthCheckPath.

  • health_check_port (Optional[str]) – AWS::ElasticLoadBalancingV2::TargetGroup.HealthCheckPort.

  • health_check_protocol (Optional[str]) – AWS::ElasticLoadBalancingV2::TargetGroup.HealthCheckProtocol.

  • health_check_timeout_seconds (Union[int, float, None]) – AWS::ElasticLoadBalancingV2::TargetGroup.HealthCheckTimeoutSeconds.

  • healthy_threshold_count (Union[int, float, None]) – AWS::ElasticLoadBalancingV2::TargetGroup.HealthyThresholdCount.

  • ip_address_type (Optional[str]) – AWS::ElasticLoadBalancingV2::TargetGroup.IpAddressType.

  • matcher (Union[IResolvable, MatcherProperty, None]) – AWS::ElasticLoadBalancingV2::TargetGroup.Matcher.

  • name (Optional[str]) – AWS::ElasticLoadBalancingV2::TargetGroup.Name.

  • port (Union[int, float, None]) – AWS::ElasticLoadBalancingV2::TargetGroup.Port.

  • protocol (Optional[str]) – AWS::ElasticLoadBalancingV2::TargetGroup.Protocol.

  • protocol_version (Optional[str]) – AWS::ElasticLoadBalancingV2::TargetGroup.ProtocolVersion.

  • tags (Optional[Sequence[CfnTag]]) – AWS::ElasticLoadBalancingV2::TargetGroup.Tags.

  • target_group_attributes (Union[IResolvable, Sequence[Union[IResolvable, TargetGroupAttributeProperty]], None]) – AWS::ElasticLoadBalancingV2::TargetGroup.TargetGroupAttributes.

  • targets (Union[IResolvable, Sequence[Union[IResolvable, TargetDescriptionProperty]], None]) – AWS::ElasticLoadBalancingV2::TargetGroup.Targets.

  • target_type (Optional[str]) – AWS::ElasticLoadBalancingV2::TargetGroup.TargetType.

  • unhealthy_threshold_count (Union[int, float, None]) – AWS::ElasticLoadBalancingV2::TargetGroup.UnhealthyThresholdCount.

  • vpc_id (Optional[str]) – AWS::ElasticLoadBalancingV2::TargetGroup.VpcId.

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

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.

Return type

None

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"
       ...
     },
   ]
   ...
}
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

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.

Return type

Any

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::ElasticLoadBalancingV2::TargetGroup'
attr_load_balancer_arns

LoadBalancerArns

Type

cloudformationAttribute

Return type

List[str]

attr_target_group_full_name

TargetGroupFullName

Type

cloudformationAttribute

Return type

str

attr_target_group_name

TargetGroupName

Type

cloudformationAttribute

Return type

str

cfn_options

Options for this resource, such as condition, update policy etc.

Return type

ICfnResourceOptions

cfn_resource_type

AWS resource type.

Return type

str

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.

Return type

List[str]

health_check_enabled

AWS::ElasticLoadBalancingV2::TargetGroup.HealthCheckEnabled.

Link

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

Return type

Union[bool, IResolvable, None]

health_check_interval_seconds

AWS::ElasticLoadBalancingV2::TargetGroup.HealthCheckIntervalSeconds.

Link

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

Return type

Union[int, float, None]

health_check_path

AWS::ElasticLoadBalancingV2::TargetGroup.HealthCheckPath.

Link

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

Return type

Optional[str]

health_check_port

AWS::ElasticLoadBalancingV2::TargetGroup.HealthCheckPort.

Link

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

Return type

Optional[str]

health_check_protocol

AWS::ElasticLoadBalancingV2::TargetGroup.HealthCheckProtocol.

Link

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

Return type

Optional[str]

health_check_timeout_seconds

AWS::ElasticLoadBalancingV2::TargetGroup.HealthCheckTimeoutSeconds.

Link

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

Return type

Union[int, float, None]

healthy_threshold_count

AWS::ElasticLoadBalancingV2::TargetGroup.HealthyThresholdCount.

Link

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

Return type

Union[int, float, None]

ip_address_type

AWS::ElasticLoadBalancingV2::TargetGroup.IpAddressType.

Link

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

Return type

Optional[str]

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

Return type

str

Returns

the logical ID as a stringified token. This value will only get resolved during synthesis.

matcher

AWS::ElasticLoadBalancingV2::TargetGroup.Matcher.

Link

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

Return type

Union[IResolvable, MatcherProperty, None]

name

AWS::ElasticLoadBalancingV2::TargetGroup.Name.

Link

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

Return type

Optional[str]

node

The construct tree node associated with this construct.

Return type

ConstructNode

port

AWS::ElasticLoadBalancingV2::TargetGroup.Port.

Link

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

Return type

Union[int, float, None]

protocol

AWS::ElasticLoadBalancingV2::TargetGroup.Protocol.

Link

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

Return type

Optional[str]

protocol_version

AWS::ElasticLoadBalancingV2::TargetGroup.ProtocolVersion.

Link

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

Return type

Optional[str]

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 }).

Return type

str

stack

The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

Return type

Stack

tags

AWS::ElasticLoadBalancingV2::TargetGroup.Tags.

Link

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

Return type

TagManager

target_group_attributes

AWS::ElasticLoadBalancingV2::TargetGroup.TargetGroupAttributes.

Link

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

Return type

Union[IResolvable, List[Union[IResolvable, TargetGroupAttributeProperty]], None]

target_type

AWS::ElasticLoadBalancingV2::TargetGroup.TargetType.

Link

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

Return type

Optional[str]

targets

AWS::ElasticLoadBalancingV2::TargetGroup.Targets.

Link

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

Return type

Union[IResolvable, List[Union[IResolvable, TargetDescriptionProperty]], None]

unhealthy_threshold_count

AWS::ElasticLoadBalancingV2::TargetGroup.UnhealthyThresholdCount.

Link

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

Return type

Union[int, float, None]

vpc_id

AWS::ElasticLoadBalancingV2::TargetGroup.VpcId.

Link

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

Return type

Optional[str]

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

MatcherProperty

class CfnTargetGroup.MatcherProperty(*, grpc_code=None, http_code=None)

Bases: object

Parameters
  • grpc_code (Optional[str]) – CfnTargetGroup.MatcherProperty.GrpcCode.

  • http_code (Optional[str]) – CfnTargetGroup.MatcherProperty.HttpCode.

Link

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

Example:

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

matcher_property = elbv2.CfnTargetGroup.MatcherProperty(
    grpc_code="grpcCode",
    http_code="httpCode"
)

Attributes

grpc_code

CfnTargetGroup.MatcherProperty.GrpcCode.

Link

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

Return type

Optional[str]

http_code

CfnTargetGroup.MatcherProperty.HttpCode.

Link

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

Return type

Optional[str]

TargetDescriptionProperty

class CfnTargetGroup.TargetDescriptionProperty(*, availability_zone=None, id, port=None)

Bases: object

Parameters
  • availability_zone (Optional[str]) – CfnTargetGroup.TargetDescriptionProperty.AvailabilityZone.

  • id (str) – CfnTargetGroup.TargetDescriptionProperty.Id.

  • port (Union[int, float, None]) – CfnTargetGroup.TargetDescriptionProperty.Port.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-targetgroup-targetdescription.html

Example:

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

target_description_property = elbv2.CfnTargetGroup.TargetDescriptionProperty(
    id="id",

    # the properties below are optional
    availability_zone="availabilityZone",
    port=123
)

Attributes

availability_zone

CfnTargetGroup.TargetDescriptionProperty.AvailabilityZone.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-targetgroup-targetdescription.html#cfn-elasticloadbalancingv2-targetgroup-targetdescription-availabilityzone

Return type

Optional[str]

id

CfnTargetGroup.TargetDescriptionProperty.Id.

Link

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

Return type

str

port

CfnTargetGroup.TargetDescriptionProperty.Port.

Link

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

Return type

Union[int, float, None]

TargetGroupAttributeProperty

class CfnTargetGroup.TargetGroupAttributeProperty(*, key=None, value=None)

Bases: object

Parameters
  • key (Optional[str]) – CfnTargetGroup.TargetGroupAttributeProperty.Key.

  • value (Optional[str]) – CfnTargetGroup.TargetGroupAttributeProperty.Value.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-targetgroup-targetgroupattribute.html

Example:

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

target_group_attribute_property = elbv2.CfnTargetGroup.TargetGroupAttributeProperty(
    key="key",
    value="value"
)

Attributes

key

CfnTargetGroup.TargetGroupAttributeProperty.Key.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-targetgroup-targetgroupattribute.html#cfn-elasticloadbalancingv2-targetgroup-targetgroupattribute-key

Return type

Optional[str]

value

CfnTargetGroup.TargetGroupAttributeProperty.Value.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-targetgroup-targetgroupattribute.html#cfn-elasticloadbalancingv2-targetgroup-targetgroupattribute-value

Return type

Optional[str]