1. Packages
  2. AWS
  3. API Docs
  4. elb
  5. LoadBalancerBackendServerPolicy
AWS v6.77.1 published on Friday, Apr 18, 2025 by Pulumi

aws.elb.LoadBalancerBackendServerPolicy

Explore with Pulumi AI

Attaches a load balancer policy to an ELB backend server.

Example Usage

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

const wu_tang = new aws.elb.LoadBalancer("wu-tang", {
    name: "wu-tang",
    availabilityZones: ["us-east-1a"],
    listeners: [{
        instancePort: 443,
        instanceProtocol: "http",
        lbPort: 443,
        lbProtocol: "https",
        sslCertificateId: "arn:aws:iam::000000000000:server-certificate/wu-tang.net",
    }],
    tags: {
        Name: "wu-tang",
    },
});
const wu_tang_ca_pubkey_policy = new aws.elb.LoadBalancerPolicy("wu-tang-ca-pubkey-policy", {
    loadBalancerName: wu_tang.name,
    policyName: "wu-tang-ca-pubkey-policy",
    policyTypeName: "PublicKeyPolicyType",
    policyAttributes: [{
        name: "PublicKey",
        value: std.file({
            input: "wu-tang-pubkey",
        }).then(invoke => invoke.result),
    }],
});
const wu_tang_root_ca_backend_auth_policy = new aws.elb.LoadBalancerPolicy("wu-tang-root-ca-backend-auth-policy", {
    loadBalancerName: wu_tang.name,
    policyName: "wu-tang-root-ca-backend-auth-policy",
    policyTypeName: "BackendServerAuthenticationPolicyType",
    policyAttributes: [{
        name: "PublicKeyPolicyName",
        value: wu_tang_root_ca_pubkey_policy.policyName,
    }],
});
const wu_tang_backend_auth_policies_443 = new aws.elb.LoadBalancerBackendServerPolicy("wu-tang-backend-auth-policies-443", {
    loadBalancerName: wu_tang.name,
    instancePort: 443,
    policyNames: [wu_tang_root_ca_backend_auth_policy.policyName],
});
Copy
import pulumi
import pulumi_aws as aws
import pulumi_std as std

wu_tang = aws.elb.LoadBalancer("wu-tang",
    name="wu-tang",
    availability_zones=["us-east-1a"],
    listeners=[{
        "instance_port": 443,
        "instance_protocol": "http",
        "lb_port": 443,
        "lb_protocol": "https",
        "ssl_certificate_id": "arn:aws:iam::000000000000:server-certificate/wu-tang.net",
    }],
    tags={
        "Name": "wu-tang",
    })
wu_tang_ca_pubkey_policy = aws.elb.LoadBalancerPolicy("wu-tang-ca-pubkey-policy",
    load_balancer_name=wu_tang.name,
    policy_name="wu-tang-ca-pubkey-policy",
    policy_type_name="PublicKeyPolicyType",
    policy_attributes=[{
        "name": "PublicKey",
        "value": std.file(input="wu-tang-pubkey").result,
    }])
wu_tang_root_ca_backend_auth_policy = aws.elb.LoadBalancerPolicy("wu-tang-root-ca-backend-auth-policy",
    load_balancer_name=wu_tang.name,
    policy_name="wu-tang-root-ca-backend-auth-policy",
    policy_type_name="BackendServerAuthenticationPolicyType",
    policy_attributes=[{
        "name": "PublicKeyPolicyName",
        "value": wu_tang_root_ca_pubkey_policy["policyName"],
    }])
wu_tang_backend_auth_policies_443 = aws.elb.LoadBalancerBackendServerPolicy("wu-tang-backend-auth-policies-443",
    load_balancer_name=wu_tang.name,
    instance_port=443,
    policy_names=[wu_tang_root_ca_backend_auth_policy.policy_name])
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		wu_tang, err := elb.NewLoadBalancer(ctx, "wu-tang", &elb.LoadBalancerArgs{
			Name: pulumi.String("wu-tang"),
			AvailabilityZones: pulumi.StringArray{
				pulumi.String("us-east-1a"),
			},
			Listeners: elb.LoadBalancerListenerArray{
				&elb.LoadBalancerListenerArgs{
					InstancePort:     pulumi.Int(443),
					InstanceProtocol: pulumi.String("http"),
					LbPort:           pulumi.Int(443),
					LbProtocol:       pulumi.String("https"),
					SslCertificateId: pulumi.String("arn:aws:iam::000000000000:server-certificate/wu-tang.net"),
				},
			},
			Tags: pulumi.StringMap{
				"Name": pulumi.String("wu-tang"),
			},
		})
		if err != nil {
			return err
		}
		invokeFile, err := std.File(ctx, &std.FileArgs{
			Input: "wu-tang-pubkey",
		}, nil)
		if err != nil {
			return err
		}
		_, err = elb.NewLoadBalancerPolicy(ctx, "wu-tang-ca-pubkey-policy", &elb.LoadBalancerPolicyArgs{
			LoadBalancerName: wu_tang.Name,
			PolicyName:       pulumi.String("wu-tang-ca-pubkey-policy"),
			PolicyTypeName:   pulumi.String("PublicKeyPolicyType"),
			PolicyAttributes: elb.LoadBalancerPolicyPolicyAttributeArray{
				&elb.LoadBalancerPolicyPolicyAttributeArgs{
					Name:  pulumi.String("PublicKey"),
					Value: pulumi.String(invokeFile.Result),
				},
			},
		})
		if err != nil {
			return err
		}
		wu_tang_root_ca_backend_auth_policy, err := elb.NewLoadBalancerPolicy(ctx, "wu-tang-root-ca-backend-auth-policy", &elb.LoadBalancerPolicyArgs{
			LoadBalancerName: wu_tang.Name,
			PolicyName:       pulumi.String("wu-tang-root-ca-backend-auth-policy"),
			PolicyTypeName:   pulumi.String("BackendServerAuthenticationPolicyType"),
			PolicyAttributes: elb.LoadBalancerPolicyPolicyAttributeArray{
				&elb.LoadBalancerPolicyPolicyAttributeArgs{
					Name:  pulumi.String("PublicKeyPolicyName"),
					Value: pulumi.Any(wu_tang_root_ca_pubkey_policy.PolicyName),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = elb.NewLoadBalancerBackendServerPolicy(ctx, "wu-tang-backend-auth-policies-443", &elb.LoadBalancerBackendServerPolicyArgs{
			LoadBalancerName: wu_tang.Name,
			InstancePort:     pulumi.Int(443),
			PolicyNames: pulumi.StringArray{
				wu_tang_root_ca_backend_auth_policy.PolicyName,
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
using Std = Pulumi.Std;

return await Deployment.RunAsync(() => 
{
    var wu_tang = new Aws.Elb.LoadBalancer("wu-tang", new()
    {
        Name = "wu-tang",
        AvailabilityZones = new[]
        {
            "us-east-1a",
        },
        Listeners = new[]
        {
            new Aws.Elb.Inputs.LoadBalancerListenerArgs
            {
                InstancePort = 443,
                InstanceProtocol = "http",
                LbPort = 443,
                LbProtocol = "https",
                SslCertificateId = "arn:aws:iam::000000000000:server-certificate/wu-tang.net",
            },
        },
        Tags = 
        {
            { "Name", "wu-tang" },
        },
    });

    var wu_tang_ca_pubkey_policy = new Aws.Elb.LoadBalancerPolicy("wu-tang-ca-pubkey-policy", new()
    {
        LoadBalancerName = wu_tang.Name,
        PolicyName = "wu-tang-ca-pubkey-policy",
        PolicyTypeName = "PublicKeyPolicyType",
        PolicyAttributes = new[]
        {
            new Aws.Elb.Inputs.LoadBalancerPolicyPolicyAttributeArgs
            {
                Name = "PublicKey",
                Value = Std.File.Invoke(new()
                {
                    Input = "wu-tang-pubkey",
                }).Apply(invoke => invoke.Result),
            },
        },
    });

    var wu_tang_root_ca_backend_auth_policy = new Aws.Elb.LoadBalancerPolicy("wu-tang-root-ca-backend-auth-policy", new()
    {
        LoadBalancerName = wu_tang.Name,
        PolicyName = "wu-tang-root-ca-backend-auth-policy",
        PolicyTypeName = "BackendServerAuthenticationPolicyType",
        PolicyAttributes = new[]
        {
            new Aws.Elb.Inputs.LoadBalancerPolicyPolicyAttributeArgs
            {
                Name = "PublicKeyPolicyName",
                Value = wu_tang_root_ca_pubkey_policy.PolicyName,
            },
        },
    });

    var wu_tang_backend_auth_policies_443 = new Aws.Elb.LoadBalancerBackendServerPolicy("wu-tang-backend-auth-policies-443", new()
    {
        LoadBalancerName = wu_tang.Name,
        InstancePort = 443,
        PolicyNames = new[]
        {
            wu_tang_root_ca_backend_auth_policy.PolicyName,
        },
    });

});
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.elb.LoadBalancerPolicy;
import com.pulumi.aws.elb.LoadBalancerPolicyArgs;
import com.pulumi.aws.elb.inputs.LoadBalancerPolicyPolicyAttributeArgs;
import com.pulumi.std.StdFunctions;
import com.pulumi.std.inputs.FileArgs;
import com.pulumi.aws.elb.LoadBalancerBackendServerPolicy;
import com.pulumi.aws.elb.LoadBalancerBackendServerPolicyArgs;
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 wu_tang = new LoadBalancer("wu-tang", LoadBalancerArgs.builder()
            .name("wu-tang")
            .availabilityZones("us-east-1a")
            .listeners(LoadBalancerListenerArgs.builder()
                .instancePort(443)
                .instanceProtocol("http")
                .lbPort(443)
                .lbProtocol("https")
                .sslCertificateId("arn:aws:iam::000000000000:server-certificate/wu-tang.net")
                .build())
            .tags(Map.of("Name", "wu-tang"))
            .build());

        var wu_tang_ca_pubkey_policy = new LoadBalancerPolicy("wu-tang-ca-pubkey-policy", LoadBalancerPolicyArgs.builder()
            .loadBalancerName(wu_tang.name())
            .policyName("wu-tang-ca-pubkey-policy")
            .policyTypeName("PublicKeyPolicyType")
            .policyAttributes(LoadBalancerPolicyPolicyAttributeArgs.builder()
                .name("PublicKey")
                .value(StdFunctions.file(FileArgs.builder()
                    .input("wu-tang-pubkey")
                    .build()).result())
                .build())
            .build());

        var wu_tang_root_ca_backend_auth_policy = new LoadBalancerPolicy("wu-tang-root-ca-backend-auth-policy", LoadBalancerPolicyArgs.builder()
            .loadBalancerName(wu_tang.name())
            .policyName("wu-tang-root-ca-backend-auth-policy")
            .policyTypeName("BackendServerAuthenticationPolicyType")
            .policyAttributes(LoadBalancerPolicyPolicyAttributeArgs.builder()
                .name("PublicKeyPolicyName")
                .value(wu_tang_root_ca_pubkey_policy.policyName())
                .build())
            .build());

        var wu_tang_backend_auth_policies_443 = new LoadBalancerBackendServerPolicy("wu-tang-backend-auth-policies-443", LoadBalancerBackendServerPolicyArgs.builder()
            .loadBalancerName(wu_tang.name())
            .instancePort(443)
            .policyNames(wu_tang_root_ca_backend_auth_policy.policyName())
            .build());

    }
}
Copy
resources:
  wu-tang:
    type: aws:elb:LoadBalancer
    properties:
      name: wu-tang
      availabilityZones:
        - us-east-1a
      listeners:
        - instancePort: 443
          instanceProtocol: http
          lbPort: 443
          lbProtocol: https
          sslCertificateId: arn:aws:iam::000000000000:server-certificate/wu-tang.net
      tags:
        Name: wu-tang
  wu-tang-ca-pubkey-policy:
    type: aws:elb:LoadBalancerPolicy
    properties:
      loadBalancerName: ${["wu-tang"].name}
      policyName: wu-tang-ca-pubkey-policy
      policyTypeName: PublicKeyPolicyType
      policyAttributes:
        - name: PublicKey
          value:
            fn::invoke:
              function: std:file
              arguments:
                input: wu-tang-pubkey
              return: result
  wu-tang-root-ca-backend-auth-policy:
    type: aws:elb:LoadBalancerPolicy
    properties:
      loadBalancerName: ${["wu-tang"].name}
      policyName: wu-tang-root-ca-backend-auth-policy
      policyTypeName: BackendServerAuthenticationPolicyType
      policyAttributes:
        - name: PublicKeyPolicyName
          value: ${["wu-tang-root-ca-pubkey-policy"].policyName}
  wu-tang-backend-auth-policies-443:
    type: aws:elb:LoadBalancerBackendServerPolicy
    properties:
      loadBalancerName: ${["wu-tang"].name}
      instancePort: 443
      policyNames:
        - ${["wu-tang-root-ca-backend-auth-policy"].policyName}
Copy

Create LoadBalancerBackendServerPolicy Resource

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

Constructor syntax

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

@overload
def LoadBalancerBackendServerPolicy(resource_name: str,
                                    opts: Optional[ResourceOptions] = None,
                                    instance_port: Optional[int] = None,
                                    load_balancer_name: Optional[str] = None,
                                    policy_names: Optional[Sequence[str]] = None)
func NewLoadBalancerBackendServerPolicy(ctx *Context, name string, args LoadBalancerBackendServerPolicyArgs, opts ...ResourceOption) (*LoadBalancerBackendServerPolicy, error)
public LoadBalancerBackendServerPolicy(string name, LoadBalancerBackendServerPolicyArgs args, CustomResourceOptions? opts = null)
public LoadBalancerBackendServerPolicy(String name, LoadBalancerBackendServerPolicyArgs args)
public LoadBalancerBackendServerPolicy(String name, LoadBalancerBackendServerPolicyArgs args, CustomResourceOptions options)
type: aws:elb:LoadBalancerBackendServerPolicy
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. LoadBalancerBackendServerPolicyArgs
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. LoadBalancerBackendServerPolicyArgs
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. LoadBalancerBackendServerPolicyArgs
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. LoadBalancerBackendServerPolicyArgs
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. LoadBalancerBackendServerPolicyArgs
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 loadBalancerBackendServerPolicyResource = new Aws.Elb.LoadBalancerBackendServerPolicy("loadBalancerBackendServerPolicyResource", new()
{
    InstancePort = 0,
    LoadBalancerName = "string",
    PolicyNames = new[]
    {
        "string",
    },
});
Copy
example, err := elb.NewLoadBalancerBackendServerPolicy(ctx, "loadBalancerBackendServerPolicyResource", &elb.LoadBalancerBackendServerPolicyArgs{
	InstancePort:     pulumi.Int(0),
	LoadBalancerName: pulumi.String("string"),
	PolicyNames: pulumi.StringArray{
		pulumi.String("string"),
	},
})
Copy
var loadBalancerBackendServerPolicyResource = new LoadBalancerBackendServerPolicy("loadBalancerBackendServerPolicyResource", LoadBalancerBackendServerPolicyArgs.builder()
    .instancePort(0)
    .loadBalancerName("string")
    .policyNames("string")
    .build());
Copy
load_balancer_backend_server_policy_resource = aws.elb.LoadBalancerBackendServerPolicy("loadBalancerBackendServerPolicyResource",
    instance_port=0,
    load_balancer_name="string",
    policy_names=["string"])
Copy
const loadBalancerBackendServerPolicyResource = new aws.elb.LoadBalancerBackendServerPolicy("loadBalancerBackendServerPolicyResource", {
    instancePort: 0,
    loadBalancerName: "string",
    policyNames: ["string"],
});
Copy
type: aws:elb:LoadBalancerBackendServerPolicy
properties:
    instancePort: 0
    loadBalancerName: string
    policyNames:
        - string
Copy

LoadBalancerBackendServerPolicy 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 LoadBalancerBackendServerPolicy resource accepts the following input properties:

InstancePort This property is required. int
The instance port to apply the policy to.
LoadBalancerName This property is required. string
The load balancer to attach the policy to.
PolicyNames List<string>
List of Policy Names to apply to the backend server.
InstancePort This property is required. int
The instance port to apply the policy to.
LoadBalancerName This property is required. string
The load balancer to attach the policy to.
PolicyNames []string
List of Policy Names to apply to the backend server.
instancePort This property is required. Integer
The instance port to apply the policy to.
loadBalancerName This property is required. String
The load balancer to attach the policy to.
policyNames List<String>
List of Policy Names to apply to the backend server.
instancePort This property is required. number
The instance port to apply the policy to.
loadBalancerName This property is required. string
The load balancer to attach the policy to.
policyNames string[]
List of Policy Names to apply to the backend server.
instance_port This property is required. int
The instance port to apply the policy to.
load_balancer_name This property is required. str
The load balancer to attach the policy to.
policy_names Sequence[str]
List of Policy Names to apply to the backend server.
instancePort This property is required. Number
The instance port to apply the policy to.
loadBalancerName This property is required. String
The load balancer to attach the policy to.
policyNames List<String>
List of Policy Names to apply to the backend server.

Outputs

All input properties are implicitly available as output properties. Additionally, the LoadBalancerBackendServerPolicy 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 LoadBalancerBackendServerPolicy Resource

Get an existing LoadBalancerBackendServerPolicy 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?: LoadBalancerBackendServerPolicyState, opts?: CustomResourceOptions): LoadBalancerBackendServerPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        instance_port: Optional[int] = None,
        load_balancer_name: Optional[str] = None,
        policy_names: Optional[Sequence[str]] = None) -> LoadBalancerBackendServerPolicy
func GetLoadBalancerBackendServerPolicy(ctx *Context, name string, id IDInput, state *LoadBalancerBackendServerPolicyState, opts ...ResourceOption) (*LoadBalancerBackendServerPolicy, error)
public static LoadBalancerBackendServerPolicy Get(string name, Input<string> id, LoadBalancerBackendServerPolicyState? state, CustomResourceOptions? opts = null)
public static LoadBalancerBackendServerPolicy get(String name, Output<String> id, LoadBalancerBackendServerPolicyState state, CustomResourceOptions options)
resources:  _:    type: aws:elb:LoadBalancerBackendServerPolicy    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:
InstancePort int
The instance port to apply the policy to.
LoadBalancerName string
The load balancer to attach the policy to.
PolicyNames List<string>
List of Policy Names to apply to the backend server.
InstancePort int
The instance port to apply the policy to.
LoadBalancerName string
The load balancer to attach the policy to.
PolicyNames []string
List of Policy Names to apply to the backend server.
instancePort Integer
The instance port to apply the policy to.
loadBalancerName String
The load balancer to attach the policy to.
policyNames List<String>
List of Policy Names to apply to the backend server.
instancePort number
The instance port to apply the policy to.
loadBalancerName string
The load balancer to attach the policy to.
policyNames string[]
List of Policy Names to apply to the backend server.
instance_port int
The instance port to apply the policy to.
load_balancer_name str
The load balancer to attach the policy to.
policy_names Sequence[str]
List of Policy Names to apply to the backend server.
instancePort Number
The instance port to apply the policy to.
loadBalancerName String
The load balancer to attach the policy to.
policyNames List<String>
List of Policy Names to apply to the backend server.

Package Details

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