1. Packages
  2. AWS
  3. API Docs
  4. lightsail
  5. LbCertificateAttachment
AWS v6.83.0 published on Monday, Jun 16, 2025 by Pulumi

aws.lightsail.LbCertificateAttachment

Explore with Pulumi AI

aws logo
AWS v6.83.0 published on Monday, Jun 16, 2025 by Pulumi

    Manages a Lightsail Load Balancer Certificate attachment to a Lightsail Load Balancer.

    Use this resource to attach a validated SSL/TLS certificate to a Lightsail Load Balancer to enable HTTPS traffic. The certificate must be validated before it can be attached to the load balancer.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.lightsail.Lb("example", {
        name: "example-load-balancer",
        healthCheckPath: "/",
        instancePort: 80,
        tags: {
            foo: "bar",
        },
    });
    const exampleLbCertificate = new aws.lightsail.LbCertificate("example", {
        name: "example-load-balancer-certificate",
        lbName: example.id,
        domainName: "example.com",
    });
    const exampleLbCertificateAttachment = new aws.lightsail.LbCertificateAttachment("example", {
        lbName: example.name,
        certificateName: exampleLbCertificate.name,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.lightsail.Lb("example",
        name="example-load-balancer",
        health_check_path="/",
        instance_port=80,
        tags={
            "foo": "bar",
        })
    example_lb_certificate = aws.lightsail.LbCertificate("example",
        name="example-load-balancer-certificate",
        lb_name=example.id,
        domain_name="example.com")
    example_lb_certificate_attachment = aws.lightsail.LbCertificateAttachment("example",
        lb_name=example.name,
        certificate_name=example_lb_certificate.name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lightsail"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := lightsail.NewLb(ctx, "example", &lightsail.LbArgs{
    			Name:            pulumi.String("example-load-balancer"),
    			HealthCheckPath: pulumi.String("/"),
    			InstancePort:    pulumi.Int(80),
    			Tags: pulumi.StringMap{
    				"foo": pulumi.String("bar"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleLbCertificate, err := lightsail.NewLbCertificate(ctx, "example", &lightsail.LbCertificateArgs{
    			Name:       pulumi.String("example-load-balancer-certificate"),
    			LbName:     example.ID(),
    			DomainName: pulumi.String("example.com"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = lightsail.NewLbCertificateAttachment(ctx, "example", &lightsail.LbCertificateAttachmentArgs{
    			LbName:          example.Name,
    			CertificateName: exampleLbCertificate.Name,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.LightSail.Lb("example", new()
        {
            Name = "example-load-balancer",
            HealthCheckPath = "/",
            InstancePort = 80,
            Tags = 
            {
                { "foo", "bar" },
            },
        });
    
        var exampleLbCertificate = new Aws.LightSail.LbCertificate("example", new()
        {
            Name = "example-load-balancer-certificate",
            LbName = example.Id,
            DomainName = "example.com",
        });
    
        var exampleLbCertificateAttachment = new Aws.LightSail.LbCertificateAttachment("example", new()
        {
            LbName = example.Name,
            CertificateName = exampleLbCertificate.Name,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.lightsail.Lb;
    import com.pulumi.aws.lightsail.LbArgs;
    import com.pulumi.aws.lightsail.LbCertificate;
    import com.pulumi.aws.lightsail.LbCertificateArgs;
    import com.pulumi.aws.lightsail.LbCertificateAttachment;
    import com.pulumi.aws.lightsail.LbCertificateAttachmentArgs;
    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 Lb("example", LbArgs.builder()
                .name("example-load-balancer")
                .healthCheckPath("/")
                .instancePort(80)
                .tags(Map.of("foo", "bar"))
                .build());
    
            var exampleLbCertificate = new LbCertificate("exampleLbCertificate", LbCertificateArgs.builder()
                .name("example-load-balancer-certificate")
                .lbName(example.id())
                .domainName("example.com")
                .build());
    
            var exampleLbCertificateAttachment = new LbCertificateAttachment("exampleLbCertificateAttachment", LbCertificateAttachmentArgs.builder()
                .lbName(example.name())
                .certificateName(exampleLbCertificate.name())
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:lightsail:Lb
        properties:
          name: example-load-balancer
          healthCheckPath: /
          instancePort: '80'
          tags:
            foo: bar
      exampleLbCertificate:
        type: aws:lightsail:LbCertificate
        name: example
        properties:
          name: example-load-balancer-certificate
          lbName: ${example.id}
          domainName: example.com
      exampleLbCertificateAttachment:
        type: aws:lightsail:LbCertificateAttachment
        name: example
        properties:
          lbName: ${example.name}
          certificateName: ${exampleLbCertificate.name}
    

    Create LbCertificateAttachment Resource

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

    Constructor syntax

    new LbCertificateAttachment(name: string, args: LbCertificateAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def LbCertificateAttachment(resource_name: str,
                                args: LbCertificateAttachmentArgs,
                                opts: Optional[ResourceOptions] = None)
    
    @overload
    def LbCertificateAttachment(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                certificate_name: Optional[str] = None,
                                lb_name: Optional[str] = None)
    func NewLbCertificateAttachment(ctx *Context, name string, args LbCertificateAttachmentArgs, opts ...ResourceOption) (*LbCertificateAttachment, error)
    public LbCertificateAttachment(string name, LbCertificateAttachmentArgs args, CustomResourceOptions? opts = null)
    public LbCertificateAttachment(String name, LbCertificateAttachmentArgs args)
    public LbCertificateAttachment(String name, LbCertificateAttachmentArgs args, CustomResourceOptions options)
    
    type: aws:lightsail:LbCertificateAttachment
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args LbCertificateAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args LbCertificateAttachmentArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args LbCertificateAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args LbCertificateAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args LbCertificateAttachmentArgs
    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 lbCertificateAttachmentResource = new Aws.LightSail.LbCertificateAttachment("lbCertificateAttachmentResource", new()
    {
        CertificateName = "string",
        LbName = "string",
    });
    
    example, err := lightsail.NewLbCertificateAttachment(ctx, "lbCertificateAttachmentResource", &lightsail.LbCertificateAttachmentArgs{
    	CertificateName: pulumi.String("string"),
    	LbName:          pulumi.String("string"),
    })
    
    var lbCertificateAttachmentResource = new LbCertificateAttachment("lbCertificateAttachmentResource", LbCertificateAttachmentArgs.builder()
        .certificateName("string")
        .lbName("string")
        .build());
    
    lb_certificate_attachment_resource = aws.lightsail.LbCertificateAttachment("lbCertificateAttachmentResource",
        certificate_name="string",
        lb_name="string")
    
    const lbCertificateAttachmentResource = new aws.lightsail.LbCertificateAttachment("lbCertificateAttachmentResource", {
        certificateName: "string",
        lbName: "string",
    });
    
    type: aws:lightsail:LbCertificateAttachment
    properties:
        certificateName: string
        lbName: string
    

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

    CertificateName string
    Name of your SSL/TLS certificate.
    LbName string
    Name of the load balancer to which you want to associate the SSL/TLS certificate.
    CertificateName string
    Name of your SSL/TLS certificate.
    LbName string
    Name of the load balancer to which you want to associate the SSL/TLS certificate.
    certificateName String
    Name of your SSL/TLS certificate.
    lbName String
    Name of the load balancer to which you want to associate the SSL/TLS certificate.
    certificateName string
    Name of your SSL/TLS certificate.
    lbName string
    Name of the load balancer to which you want to associate the SSL/TLS certificate.
    certificate_name str
    Name of your SSL/TLS certificate.
    lb_name str
    Name of the load balancer to which you want to associate the SSL/TLS certificate.
    certificateName String
    Name of your SSL/TLS certificate.
    lbName String
    Name of the load balancer to which you want to associate the SSL/TLS certificate.

    Outputs

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

    Get an existing LbCertificateAttachment 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?: LbCertificateAttachmentState, opts?: CustomResourceOptions): LbCertificateAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            certificate_name: Optional[str] = None,
            lb_name: Optional[str] = None) -> LbCertificateAttachment
    func GetLbCertificateAttachment(ctx *Context, name string, id IDInput, state *LbCertificateAttachmentState, opts ...ResourceOption) (*LbCertificateAttachment, error)
    public static LbCertificateAttachment Get(string name, Input<string> id, LbCertificateAttachmentState? state, CustomResourceOptions? opts = null)
    public static LbCertificateAttachment get(String name, Output<String> id, LbCertificateAttachmentState state, CustomResourceOptions options)
    resources:  _:    type: aws:lightsail:LbCertificateAttachment    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    CertificateName string
    Name of your SSL/TLS certificate.
    LbName string
    Name of the load balancer to which you want to associate the SSL/TLS certificate.
    CertificateName string
    Name of your SSL/TLS certificate.
    LbName string
    Name of the load balancer to which you want to associate the SSL/TLS certificate.
    certificateName String
    Name of your SSL/TLS certificate.
    lbName String
    Name of the load balancer to which you want to associate the SSL/TLS certificate.
    certificateName string
    Name of your SSL/TLS certificate.
    lbName string
    Name of the load balancer to which you want to associate the SSL/TLS certificate.
    certificate_name str
    Name of your SSL/TLS certificate.
    lb_name str
    Name of the load balancer to which you want to associate the SSL/TLS certificate.
    certificateName String
    Name of your SSL/TLS certificate.
    lbName String
    Name of the load balancer to which you want to associate the SSL/TLS certificate.

    Import

    Using pulumi import, import aws_lightsail_lb_certificate_attachment using the name attribute. For example:

    $ pulumi import aws:lightsail/lbCertificateAttachment:LbCertificateAttachment example example-load-balancer,example-certificate
    

    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.
    aws logo
    AWS v6.83.0 published on Monday, Jun 16, 2025 by Pulumi