Show / Hide Table of Contents

Class TargetGroupAttachment

Provides the ability to register instances and containers with an Application Load Balancer (ALB) or Network Load Balancer (NLB) target group. For attaching resources with Elastic Load Balancer (ELB), see the aws.elb.Attachment resource.

Note: aws.alb.TargetGroupAttachment is known as aws.lb.TargetGroupAttachment. The functionality is identical.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var testTargetGroup = new Aws.LB.TargetGroup("testTargetGroup", new Aws.LB.TargetGroupArgs
    {
    });
    var testInstance = new Aws.Ec2.Instance("testInstance", new Aws.Ec2.InstanceArgs
    {
    });
    var testTargetGroupAttachment = new Aws.LB.TargetGroupAttachment("testTargetGroupAttachment", new Aws.LB.TargetGroupAttachmentArgs
    {
        Port = 80,
        TargetGroupArn = testTargetGroup.Arn,
        TargetId = testInstance.Id,
    });
}

}

Usage with lambda

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var testTargetGroup = new Aws.LB.TargetGroup("testTargetGroup", new Aws.LB.TargetGroupArgs
    {
        TargetType = "lambda",
    });
    var testFunction = new Aws.Lambda.Function("testFunction", new Aws.Lambda.FunctionArgs
    {
    });
    var withLb = new Aws.Lambda.Permission("withLb", new Aws.Lambda.PermissionArgs
    {
        Action = "lambda:InvokeFunction",
        Function = testFunction.Arn,
        Principal = "elasticloadbalancing.amazonaws.com",
        SourceArn = testTargetGroup.Arn,
    });
    var testTargetGroupAttachment = new Aws.LB.TargetGroupAttachment("testTargetGroupAttachment", new Aws.LB.TargetGroupAttachmentArgs
    {
        TargetGroupArn = testTargetGroup.Arn,
        TargetId = testFunction.Arn,
    });
}

}
Inheritance
System.Object
Resource
CustomResource
TargetGroupAttachment
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Aws.ApplicationLoadBalancing
Assembly: Pulumi.Aws.dll
Syntax
[Obsolete("aws.applicationloadbalancing.TargetGroupAttachment has been deprecated in favor of aws.alb.TargetGroupAttachment")]
public class TargetGroupAttachment : CustomResource

Constructors

View Source

TargetGroupAttachment(String, TargetGroupAttachmentArgs, CustomResourceOptions)

Create a TargetGroupAttachment resource with the given unique name, arguments, and options.

Declaration
public TargetGroupAttachment(string name, TargetGroupAttachmentArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

TargetGroupAttachmentArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

AvailabilityZone

The Availability Zone where the IP address of the target is to be registered.

Declaration
public Output<string> AvailabilityZone { get; }
Property Value
Type Description
Output<System.String>
View Source

Port

The port on which targets receive traffic.

Declaration
public Output<int?> Port { get; }
Property Value
Type Description
Output<System.Nullable<System.Int32>>
View Source

TargetGroupArn

The ARN of the target group with which to register targets

Declaration
public Output<string> TargetGroupArn { get; }
Property Value
Type Description
Output<System.String>
View Source

TargetId

The ID of the target. This is the Instance ID for an instance, or the container ID for an ECS container. If the target type is ip, specify an IP address. If the target type is lambda, specify the arn of lambda.

Declaration
public Output<string> TargetId { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, TargetGroupAttachmentState, CustomResourceOptions)

Get an existing TargetGroupAttachment resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static TargetGroupAttachment Get(string name, Input<string> id, TargetGroupAttachmentState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

TargetGroupAttachmentState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
TargetGroupAttachment
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.