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

aws.alb.ListenerCertificate

Explore with Pulumi AI

Provides a Load Balancer Listener Certificate resource.

This resource is for additional certificates and does not replace the default certificate on the listener.

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

Example Usage

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

const example = new aws.acm.Certificate("example", {});
const frontEnd = new aws.lb.LoadBalancer("front_end", {});
const frontEndListener = new aws.lb.Listener("front_end", {});
const exampleListenerCertificate = new aws.lb.ListenerCertificate("example", {
    listenerArn: frontEndListener.arn,
    certificateArn: example.arn,
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.acm.Certificate("example")
front_end = aws.lb.LoadBalancer("front_end")
front_end_listener = aws.lb.Listener("front_end")
example_listener_certificate = aws.lb.ListenerCertificate("example",
    listener_arn=front_end_listener.arn,
    certificate_arn=example.arn)
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/acm"
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lb"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := acm.NewCertificate(ctx, "example", nil)
		if err != nil {
			return err
		}
		_, err = lb.NewLoadBalancer(ctx, "front_end", nil)
		if err != nil {
			return err
		}
		frontEndListener, err := lb.NewListener(ctx, "front_end", nil)
		if err != nil {
			return err
		}
		_, err = lb.NewListenerCertificate(ctx, "example", &lb.ListenerCertificateArgs{
			ListenerArn:    frontEndListener.Arn,
			CertificateArn: example.Arn,
		})
		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 example = new Aws.Acm.Certificate("example");

    var frontEnd = new Aws.LB.LoadBalancer("front_end");

    var frontEndListener = new Aws.LB.Listener("front_end");

    var exampleListenerCertificate = new Aws.LB.ListenerCertificate("example", new()
    {
        ListenerArn = frontEndListener.Arn,
        CertificateArn = example.Arn,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.acm.Certificate;
import com.pulumi.aws.lb.LoadBalancer;
import com.pulumi.aws.lb.Listener;
import com.pulumi.aws.lb.ListenerCertificate;
import com.pulumi.aws.lb.ListenerCertificateArgs;
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 example = new Certificate("example");

        var frontEnd = new LoadBalancer("frontEnd");

        var frontEndListener = new Listener("frontEndListener");

        var exampleListenerCertificate = new ListenerCertificate("exampleListenerCertificate", ListenerCertificateArgs.builder()
            .listenerArn(frontEndListener.arn())
            .certificateArn(example.arn())
            .build());

    }
}
Copy
resources:
  example:
    type: aws:acm:Certificate
  frontEnd:
    type: aws:lb:LoadBalancer
    name: front_end
  frontEndListener:
    type: aws:lb:Listener
    name: front_end
  exampleListenerCertificate:
    type: aws:lb:ListenerCertificate
    name: example
    properties:
      listenerArn: ${frontEndListener.arn}
      certificateArn: ${example.arn}
Copy

Create ListenerCertificate Resource

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

Constructor syntax

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

@overload
def ListenerCertificate(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        certificate_arn: Optional[str] = None,
                        listener_arn: Optional[str] = None)
func NewListenerCertificate(ctx *Context, name string, args ListenerCertificateArgs, opts ...ResourceOption) (*ListenerCertificate, error)
public ListenerCertificate(string name, ListenerCertificateArgs args, CustomResourceOptions? opts = null)
public ListenerCertificate(String name, ListenerCertificateArgs args)
public ListenerCertificate(String name, ListenerCertificateArgs args, CustomResourceOptions options)
type: aws:alb:ListenerCertificate
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. ListenerCertificateArgs
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. ListenerCertificateArgs
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. ListenerCertificateArgs
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. ListenerCertificateArgs
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. ListenerCertificateArgs
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 listenerCertificateResource = new Aws.Alb.ListenerCertificate("listenerCertificateResource", new()
{
    CertificateArn = "string",
    ListenerArn = "string",
});
Copy
example, err := alb.NewListenerCertificate(ctx, "listenerCertificateResource", &alb.ListenerCertificateArgs{
	CertificateArn: pulumi.String("string"),
	ListenerArn:    pulumi.String("string"),
})
Copy
var listenerCertificateResource = new ListenerCertificate("listenerCertificateResource", ListenerCertificateArgs.builder()
    .certificateArn("string")
    .listenerArn("string")
    .build());
Copy
listener_certificate_resource = aws.alb.ListenerCertificate("listenerCertificateResource",
    certificate_arn="string",
    listener_arn="string")
Copy
const listenerCertificateResource = new aws.alb.ListenerCertificate("listenerCertificateResource", {
    certificateArn: "string",
    listenerArn: "string",
});
Copy
type: aws:alb:ListenerCertificate
properties:
    certificateArn: string
    listenerArn: string
Copy

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

CertificateArn
This property is required.
Changes to this property will trigger replacement.
string
The ARN of the certificate to attach to the listener.
ListenerArn
This property is required.
Changes to this property will trigger replacement.
string
The ARN of the listener to which to attach the certificate.
CertificateArn
This property is required.
Changes to this property will trigger replacement.
string
The ARN of the certificate to attach to the listener.
ListenerArn
This property is required.
Changes to this property will trigger replacement.
string
The ARN of the listener to which to attach the certificate.
certificateArn
This property is required.
Changes to this property will trigger replacement.
String
The ARN of the certificate to attach to the listener.
listenerArn
This property is required.
Changes to this property will trigger replacement.
String
The ARN of the listener to which to attach the certificate.
certificateArn
This property is required.
Changes to this property will trigger replacement.
string
The ARN of the certificate to attach to the listener.
listenerArn
This property is required.
Changes to this property will trigger replacement.
string
The ARN of the listener to which to attach the certificate.
certificate_arn
This property is required.
Changes to this property will trigger replacement.
str
The ARN of the certificate to attach to the listener.
listener_arn
This property is required.
Changes to this property will trigger replacement.
str
The ARN of the listener to which to attach the certificate.
certificateArn
This property is required.
Changes to this property will trigger replacement.
String
The ARN of the certificate to attach to the listener.
listenerArn
This property is required.
Changes to this property will trigger replacement.
String
The ARN of the listener to which to attach the certificate.

Outputs

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

Get an existing ListenerCertificate 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?: ListenerCertificateState, opts?: CustomResourceOptions): ListenerCertificate
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        certificate_arn: Optional[str] = None,
        listener_arn: Optional[str] = None) -> ListenerCertificate
func GetListenerCertificate(ctx *Context, name string, id IDInput, state *ListenerCertificateState, opts ...ResourceOption) (*ListenerCertificate, error)
public static ListenerCertificate Get(string name, Input<string> id, ListenerCertificateState? state, CustomResourceOptions? opts = null)
public static ListenerCertificate get(String name, Output<String> id, ListenerCertificateState state, CustomResourceOptions options)
resources:  _:    type: aws:alb:ListenerCertificate    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:
CertificateArn Changes to this property will trigger replacement. string
The ARN of the certificate to attach to the listener.
ListenerArn Changes to this property will trigger replacement. string
The ARN of the listener to which to attach the certificate.
CertificateArn Changes to this property will trigger replacement. string
The ARN of the certificate to attach to the listener.
ListenerArn Changes to this property will trigger replacement. string
The ARN of the listener to which to attach the certificate.
certificateArn Changes to this property will trigger replacement. String
The ARN of the certificate to attach to the listener.
listenerArn Changes to this property will trigger replacement. String
The ARN of the listener to which to attach the certificate.
certificateArn Changes to this property will trigger replacement. string
The ARN of the certificate to attach to the listener.
listenerArn Changes to this property will trigger replacement. string
The ARN of the listener to which to attach the certificate.
certificate_arn Changes to this property will trigger replacement. str
The ARN of the certificate to attach to the listener.
listener_arn Changes to this property will trigger replacement. str
The ARN of the listener to which to attach the certificate.
certificateArn Changes to this property will trigger replacement. String
The ARN of the certificate to attach to the listener.
listenerArn Changes to this property will trigger replacement. String
The ARN of the listener to which to attach the certificate.

Import

Using pulumi import, import Listener Certificates using the listener arn and certificate arn, separated by an underscore (_). For example:

$ pulumi import aws:alb/listenerCertificate:ListenerCertificate example arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/test/8e4497da625e2d8a/9ab28ade35828f96/67b3d2d36dd7c26b_arn:aws:iam::123456789012:server-certificate/tf-acc-test-6453083910015726063
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

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