1. Packages
  2. AWS
  3. API Docs
  4. ec2
  5. ProxyProtocolPolicy
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.ec2.ProxyProtocolPolicy

Explore with Pulumi AI

Provides a proxy protocol policy, which allows an ELB to carry a client connection information to a backend.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const lb = new aws.elb.LoadBalancer("lb", {
    name: "test-lb",
    availabilityZones: ["us-east-1a"],
    listeners: [
        {
            instancePort: 25,
            instanceProtocol: "tcp",
            lbPort: 25,
            lbProtocol: "tcp",
        },
        {
            instancePort: 587,
            instanceProtocol: "tcp",
            lbPort: 587,
            lbProtocol: "tcp",
        },
    ],
});
const smtp = new aws.ec2.ProxyProtocolPolicy("smtp", {
    loadBalancer: lb.name,
    instancePorts: [
        "25",
        "587",
    ],
});
Copy
import pulumi
import pulumi_aws as aws

lb = aws.elb.LoadBalancer("lb",
    name="test-lb",
    availability_zones=["us-east-1a"],
    listeners=[
        {
            "instance_port": 25,
            "instance_protocol": "tcp",
            "lb_port": 25,
            "lb_protocol": "tcp",
        },
        {
            "instance_port": 587,
            "instance_protocol": "tcp",
            "lb_port": 587,
            "lb_protocol": "tcp",
        },
    ])
smtp = aws.ec2.ProxyProtocolPolicy("smtp",
    load_balancer=lb.name,
    instance_ports=[
        "25",
        "587",
    ])
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/elb"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		lb, err := elb.NewLoadBalancer(ctx, "lb", &elb.LoadBalancerArgs{
			Name: pulumi.String("test-lb"),
			AvailabilityZones: pulumi.StringArray{
				pulumi.String("us-east-1a"),
			},
			Listeners: elb.LoadBalancerListenerArray{
				&elb.LoadBalancerListenerArgs{
					InstancePort:     pulumi.Int(25),
					InstanceProtocol: pulumi.String("tcp"),
					LbPort:           pulumi.Int(25),
					LbProtocol:       pulumi.String("tcp"),
				},
				&elb.LoadBalancerListenerArgs{
					InstancePort:     pulumi.Int(587),
					InstanceProtocol: pulumi.String("tcp"),
					LbPort:           pulumi.Int(587),
					LbProtocol:       pulumi.String("tcp"),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = ec2.NewProxyProtocolPolicy(ctx, "smtp", &ec2.ProxyProtocolPolicyArgs{
			LoadBalancer: lb.Name,
			InstancePorts: pulumi.StringArray{
				pulumi.String("25"),
				pulumi.String("587"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var lb = new Aws.Elb.LoadBalancer("lb", new()
    {
        Name = "test-lb",
        AvailabilityZones = new[]
        {
            "us-east-1a",
        },
        Listeners = new[]
        {
            new Aws.Elb.Inputs.LoadBalancerListenerArgs
            {
                InstancePort = 25,
                InstanceProtocol = "tcp",
                LbPort = 25,
                LbProtocol = "tcp",
            },
            new Aws.Elb.Inputs.LoadBalancerListenerArgs
            {
                InstancePort = 587,
                InstanceProtocol = "tcp",
                LbPort = 587,
                LbProtocol = "tcp",
            },
        },
    });

    var smtp = new Aws.Ec2.ProxyProtocolPolicy("smtp", new()
    {
        LoadBalancer = lb.Name,
        InstancePorts = new[]
        {
            "25",
            "587",
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.elb.LoadBalancer;
import com.pulumi.aws.elb.LoadBalancerArgs;
import com.pulumi.aws.elb.inputs.LoadBalancerListenerArgs;
import com.pulumi.aws.ec2.ProxyProtocolPolicy;
import com.pulumi.aws.ec2.ProxyProtocolPolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var lb = new LoadBalancer("lb", LoadBalancerArgs.builder()
            .name("test-lb")
            .availabilityZones("us-east-1a")
            .listeners(            
                LoadBalancerListenerArgs.builder()
                    .instancePort(25)
                    .instanceProtocol("tcp")
                    .lbPort(25)
                    .lbProtocol("tcp")
                    .build(),
                LoadBalancerListenerArgs.builder()
                    .instancePort(587)
                    .instanceProtocol("tcp")
                    .lbPort(587)
                    .lbProtocol("tcp")
                    .build())
            .build());

        var smtp = new ProxyProtocolPolicy("smtp", ProxyProtocolPolicyArgs.builder()
            .loadBalancer(lb.name())
            .instancePorts(            
                "25",
                "587")
            .build());

    }
}
Copy
resources:
  lb:
    type: aws:elb:LoadBalancer
    properties:
      name: test-lb
      availabilityZones:
        - us-east-1a
      listeners:
        - instancePort: 25
          instanceProtocol: tcp
          lbPort: 25
          lbProtocol: tcp
        - instancePort: 587
          instanceProtocol: tcp
          lbPort: 587
          lbProtocol: tcp
  smtp:
    type: aws:ec2:ProxyProtocolPolicy
    properties:
      loadBalancer: ${lb.name}
      instancePorts:
        - '25'
        - '587'
Copy

Create ProxyProtocolPolicy Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ProxyProtocolPolicy(name: string, args: ProxyProtocolPolicyArgs, opts?: CustomResourceOptions);
@overload
def ProxyProtocolPolicy(resource_name: str,
                        args: ProxyProtocolPolicyArgs,
                        opts: Optional[ResourceOptions] = None)

@overload
def ProxyProtocolPolicy(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        instance_ports: Optional[Sequence[str]] = None,
                        load_balancer: Optional[str] = None)
func NewProxyProtocolPolicy(ctx *Context, name string, args ProxyProtocolPolicyArgs, opts ...ResourceOption) (*ProxyProtocolPolicy, error)
public ProxyProtocolPolicy(string name, ProxyProtocolPolicyArgs args, CustomResourceOptions? opts = null)
public ProxyProtocolPolicy(String name, ProxyProtocolPolicyArgs args)
public ProxyProtocolPolicy(String name, ProxyProtocolPolicyArgs args, CustomResourceOptions options)
type: aws:ec2:ProxyProtocolPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ProxyProtocolPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ProxyProtocolPolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ProxyProtocolPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ProxyProtocolPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ProxyProtocolPolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var proxyProtocolPolicyResource = new Aws.Ec2.ProxyProtocolPolicy("proxyProtocolPolicyResource", new()
{
    InstancePorts = new[]
    {
        "string",
    },
    LoadBalancer = "string",
});
Copy
example, err := ec2.NewProxyProtocolPolicy(ctx, "proxyProtocolPolicyResource", &ec2.ProxyProtocolPolicyArgs{
	InstancePorts: pulumi.StringArray{
		pulumi.String("string"),
	},
	LoadBalancer: pulumi.String("string"),
})
Copy
var proxyProtocolPolicyResource = new ProxyProtocolPolicy("proxyProtocolPolicyResource", ProxyProtocolPolicyArgs.builder()
    .instancePorts("string")
    .loadBalancer("string")
    .build());
Copy
proxy_protocol_policy_resource = aws.ec2.ProxyProtocolPolicy("proxyProtocolPolicyResource",
    instance_ports=["string"],
    load_balancer="string")
Copy
const proxyProtocolPolicyResource = new aws.ec2.ProxyProtocolPolicy("proxyProtocolPolicyResource", {
    instancePorts: ["string"],
    loadBalancer: "string",
});
Copy
type: aws:ec2:ProxyProtocolPolicy
properties:
    instancePorts:
        - string
    loadBalancer: string
Copy

ProxyProtocolPolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ProxyProtocolPolicy resource accepts the following input properties:

InstancePorts This property is required. List<string>
List of instance ports to which the policy should be applied. This can be specified if the protocol is SSL or TCP.
LoadBalancer This property is required. string
The load balancer to which the policy should be attached.
InstancePorts This property is required. []string
List of instance ports to which the policy should be applied. This can be specified if the protocol is SSL or TCP.
LoadBalancer This property is required. string
The load balancer to which the policy should be attached.
instancePorts This property is required. List<String>
List of instance ports to which the policy should be applied. This can be specified if the protocol is SSL or TCP.
loadBalancer This property is required. String
The load balancer to which the policy should be attached.
instancePorts This property is required. string[]
List of instance ports to which the policy should be applied. This can be specified if the protocol is SSL or TCP.
loadBalancer This property is required. string
The load balancer to which the policy should be attached.
instance_ports This property is required. Sequence[str]
List of instance ports to which the policy should be applied. This can be specified if the protocol is SSL or TCP.
load_balancer This property is required. str
The load balancer to which the policy should be attached.
instancePorts This property is required. List<String>
List of instance ports to which the policy should be applied. This can be specified if the protocol is SSL or TCP.
loadBalancer This property is required. String
The load balancer to which the policy should be attached.

Outputs

All input properties are implicitly available as output properties. Additionally, the ProxyProtocolPolicy resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing ProxyProtocolPolicy Resource

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

public static get(name: string, id: Input<ID>, state?: ProxyProtocolPolicyState, opts?: CustomResourceOptions): ProxyProtocolPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        instance_ports: Optional[Sequence[str]] = None,
        load_balancer: Optional[str] = None) -> ProxyProtocolPolicy
func GetProxyProtocolPolicy(ctx *Context, name string, id IDInput, state *ProxyProtocolPolicyState, opts ...ResourceOption) (*ProxyProtocolPolicy, error)
public static ProxyProtocolPolicy Get(string name, Input<string> id, ProxyProtocolPolicyState? state, CustomResourceOptions? opts = null)
public static ProxyProtocolPolicy get(String name, Output<String> id, ProxyProtocolPolicyState state, CustomResourceOptions options)
resources:  _:    type: aws:ec2:ProxyProtocolPolicy    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
InstancePorts List<string>
List of instance ports to which the policy should be applied. This can be specified if the protocol is SSL or TCP.
LoadBalancer string
The load balancer to which the policy should be attached.
InstancePorts []string
List of instance ports to which the policy should be applied. This can be specified if the protocol is SSL or TCP.
LoadBalancer string
The load balancer to which the policy should be attached.
instancePorts List<String>
List of instance ports to which the policy should be applied. This can be specified if the protocol is SSL or TCP.
loadBalancer String
The load balancer to which the policy should be attached.
instancePorts string[]
List of instance ports to which the policy should be applied. This can be specified if the protocol is SSL or TCP.
loadBalancer string
The load balancer to which the policy should be attached.
instance_ports Sequence[str]
List of instance ports to which the policy should be applied. This can be specified if the protocol is SSL or TCP.
load_balancer str
The load balancer to which the policy should be attached.
instancePorts List<String>
List of instance ports to which the policy should be applied. This can be specified if the protocol is SSL or TCP.
loadBalancer String
The load balancer to which the policy should be attached.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.