Skip to content

Resource: awsLoadBalancerBackendServerPolicy

Attaches a load balancer policy to an ELB backend server.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsElbWuTang = new aws.elb.Elb(this, "wu-tang", {
  availabilityZones: ["us-east-1a"],
  listener: [
    {
      instancePort: 443,
      instanceProtocol: "http",
      lbPort: 443,
      lbProtocol: "https",
      sslCertificateId:
        "arn:aws:iam::000000000000:server-certificate/wu-tang.net",
    },
  ],
  name: "wu-tang",
  tags: {
    Name: "wu-tang",
  },
});
new aws.loadBalancerPolicy.LoadBalancerPolicy(
  this,
  "wu-tang-ca-pubkey-policy",
  {
    loadBalancerName: awsElbWuTang.name,
    policyAttribute: [
      {
        name: "PublicKey",
        value: '${file("wu-tang-pubkey")}',
      },
    ],
    policyName: "wu-tang-ca-pubkey-policy",
    policyTypeName: "PublicKeyPolicyType",
  }
);
const awsLoadBalancerPolicyWuTangRootCaBackendAuthPolicy =
  new aws.loadBalancerPolicy.LoadBalancerPolicy(
    this,
    "wu-tang-root-ca-backend-auth-policy",
    {
      loadBalancerName: awsElbWuTang.name,
      policyAttribute: [
        {
          name: "PublicKeyPolicyName",
          value:
            "${aws_load_balancer_policy.wu-tang-root-ca-pubkey-policy.policy_name}",
        },
      ],
      policyName: "wu-tang-root-ca-backend-auth-policy",
      policyTypeName: "BackendServerAuthenticationPolicyType",
    }
  );
new aws.loadBalancerBackendServerPolicy.LoadBalancerBackendServerPolicy(
  this,
  "wu-tang-backend-auth-policies-443",
  {
    instancePort: 443,
    loadBalancerName: awsElbWuTang.name,
    policyNames: [
      awsLoadBalancerPolicyWuTangRootCaBackendAuthPolicy.policyName,
    ],
  }
);

Argument Reference

The following arguments are supported:

  • loadBalancerName - (Required) The load balancer to attach the policy to.
  • policyNames - (Required) List of Policy Names to apply to the backend server.
  • instancePort - (Required) The instance port to apply the policy to.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - The ID of the policy.
  • loadBalancerName - The load balancer on which the policy is defined.
  • instancePort - The backend port the policies are applied to