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

aws.lightsail.KeyPair

Explore with Pulumi AI

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

    Manages a Lightsail Key Pair for use with Lightsail Instances. Use this resource to create or import key pairs that are separate from EC2 Key Pairs and required for Lightsail instances.

    Note: Lightsail is currently only supported in a limited number of AWS Regions, please see “Regions and Availability Zones in Amazon Lightsail” for more details

    Example Usage

    Create New Key Pair

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.lightsail.KeyPair("example", {name: "example"});
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.lightsail.KeyPair("example", name="example")
    
    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 {
    		_, err := lightsail.NewKeyPair(ctx, "example", &lightsail.KeyPairArgs{
    			Name: pulumi.String("example"),
    		})
    		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.KeyPair("example", new()
        {
            Name = "example",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.lightsail.KeyPair;
    import com.pulumi.aws.lightsail.KeyPairArgs;
    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 KeyPair("example", KeyPairArgs.builder()
                .name("example")
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:lightsail:KeyPair
        properties:
          name: example
    

    Create New Key Pair with PGP Encrypted Private Key

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.lightsail.KeyPair("example", {
        name: "example",
        pgpKey: "keybase:keybaseusername",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.lightsail.KeyPair("example",
        name="example",
        pgp_key="keybase:keybaseusername")
    
    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 {
    		_, err := lightsail.NewKeyPair(ctx, "example", &lightsail.KeyPairArgs{
    			Name:   pulumi.String("example"),
    			PgpKey: pulumi.String("keybase:keybaseusername"),
    		})
    		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.KeyPair("example", new()
        {
            Name = "example",
            PgpKey = "keybase:keybaseusername",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.lightsail.KeyPair;
    import com.pulumi.aws.lightsail.KeyPairArgs;
    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 KeyPair("example", KeyPairArgs.builder()
                .name("example")
                .pgpKey("keybase:keybaseusername")
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:lightsail:KeyPair
        properties:
          name: example
          pgpKey: keybase:keybaseusername
    

    Existing Public Key Import

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    import * as std from "@pulumi/std";
    
    const example = new aws.lightsail.KeyPair("example", {
        name: "example",
        publicKey: std.file({
            input: "~/.ssh/id_rsa.pub",
        }).then(invoke => invoke.result),
    });
    
    import pulumi
    import pulumi_aws as aws
    import pulumi_std as std
    
    example = aws.lightsail.KeyPair("example",
        name="example",
        public_key=std.file(input="~/.ssh/id_rsa.pub").result)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lightsail"
    	"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 {
    		invokeFile, err := std.File(ctx, &std.FileArgs{
    			Input: "~/.ssh/id_rsa.pub",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = lightsail.NewKeyPair(ctx, "example", &lightsail.KeyPairArgs{
    			Name:      pulumi.String("example"),
    			PublicKey: pulumi.String(invokeFile.Result),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    using Std = Pulumi.Std;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.LightSail.KeyPair("example", new()
        {
            Name = "example",
            PublicKey = Std.File.Invoke(new()
            {
                Input = "~/.ssh/id_rsa.pub",
            }).Apply(invoke => invoke.Result),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.lightsail.KeyPair;
    import com.pulumi.aws.lightsail.KeyPairArgs;
    import com.pulumi.std.StdFunctions;
    import com.pulumi.std.inputs.FileArgs;
    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 KeyPair("example", KeyPairArgs.builder()
                .name("example")
                .publicKey(StdFunctions.file(FileArgs.builder()
                    .input("~/.ssh/id_rsa.pub")
                    .build()).result())
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:lightsail:KeyPair
        properties:
          name: example
          publicKey:
            fn::invoke:
              function: std:file
              arguments:
                input: ~/.ssh/id_rsa.pub
              return: result
    

    Create KeyPair Resource

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

    Constructor syntax

    new KeyPair(name: string, args?: KeyPairArgs, opts?: CustomResourceOptions);
    @overload
    def KeyPair(resource_name: str,
                args: Optional[KeyPairArgs] = None,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def KeyPair(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                name: Optional[str] = None,
                name_prefix: Optional[str] = None,
                pgp_key: Optional[str] = None,
                public_key: Optional[str] = None,
                tags: Optional[Mapping[str, str]] = None)
    func NewKeyPair(ctx *Context, name string, args *KeyPairArgs, opts ...ResourceOption) (*KeyPair, error)
    public KeyPair(string name, KeyPairArgs? args = null, CustomResourceOptions? opts = null)
    public KeyPair(String name, KeyPairArgs args)
    public KeyPair(String name, KeyPairArgs args, CustomResourceOptions options)
    
    type: aws:lightsail:KeyPair
    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 KeyPairArgs
    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 KeyPairArgs
    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 KeyPairArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args KeyPairArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args KeyPairArgs
    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 awsKeyPairResource = new Aws.LightSail.KeyPair("awsKeyPairResource", new()
    {
        Name = "string",
        NamePrefix = "string",
        PgpKey = "string",
        PublicKey = "string",
        Tags = 
        {
            { "string", "string" },
        },
    });
    
    example, err := lightsail.NewKeyPair(ctx, "awsKeyPairResource", &lightsail.KeyPairArgs{
    	Name:       pulumi.String("string"),
    	NamePrefix: pulumi.String("string"),
    	PgpKey:     pulumi.String("string"),
    	PublicKey:  pulumi.String("string"),
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var awsKeyPairResource = new com.pulumi.aws.lightsail.KeyPair("awsKeyPairResource", com.pulumi.aws.lightsail.KeyPairArgs.builder()
        .name("string")
        .namePrefix("string")
        .pgpKey("string")
        .publicKey("string")
        .tags(Map.of("string", "string"))
        .build());
    
    aws_key_pair_resource = aws.lightsail.KeyPair("awsKeyPairResource",
        name="string",
        name_prefix="string",
        pgp_key="string",
        public_key="string",
        tags={
            "string": "string",
        })
    
    const awsKeyPairResource = new aws.lightsail.KeyPair("awsKeyPairResource", {
        name: "string",
        namePrefix: "string",
        pgpKey: "string",
        publicKey: "string",
        tags: {
            string: "string",
        },
    });
    
    type: aws:lightsail:KeyPair
    properties:
        name: string
        namePrefix: string
        pgpKey: string
        publicKey: string
        tags:
            string: string
    

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

    Name string
    Name of the Lightsail Key Pair. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
    NamePrefix string
    Creates a unique name beginning with the specified prefix. Conflicts with name.
    PgpKey string
    PGP key to encrypt the resulting private key material. Only used when creating a new key pair.
    PublicKey string
    Public key material. This public key will be imported into Lightsail.
    Tags Dictionary<string, string>

    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Note: A PGP key is not required, however it is strongly encouraged. Without a PGP key, the private key material will be stored in state unencrypted. pgp_key is ignored if public_key is supplied.

    Name string
    Name of the Lightsail Key Pair. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
    NamePrefix string
    Creates a unique name beginning with the specified prefix. Conflicts with name.
    PgpKey string
    PGP key to encrypt the resulting private key material. Only used when creating a new key pair.
    PublicKey string
    Public key material. This public key will be imported into Lightsail.
    Tags map[string]string

    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Note: A PGP key is not required, however it is strongly encouraged. Without a PGP key, the private key material will be stored in state unencrypted. pgp_key is ignored if public_key is supplied.

    name String
    Name of the Lightsail Key Pair. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
    namePrefix String
    Creates a unique name beginning with the specified prefix. Conflicts with name.
    pgpKey String
    PGP key to encrypt the resulting private key material. Only used when creating a new key pair.
    publicKey String
    Public key material. This public key will be imported into Lightsail.
    tags Map<String,String>

    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Note: A PGP key is not required, however it is strongly encouraged. Without a PGP key, the private key material will be stored in state unencrypted. pgp_key is ignored if public_key is supplied.

    name string
    Name of the Lightsail Key Pair. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
    namePrefix string
    Creates a unique name beginning with the specified prefix. Conflicts with name.
    pgpKey string
    PGP key to encrypt the resulting private key material. Only used when creating a new key pair.
    publicKey string
    Public key material. This public key will be imported into Lightsail.
    tags {[key: string]: string}

    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Note: A PGP key is not required, however it is strongly encouraged. Without a PGP key, the private key material will be stored in state unencrypted. pgp_key is ignored if public_key is supplied.

    name str
    Name of the Lightsail Key Pair. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
    name_prefix str
    Creates a unique name beginning with the specified prefix. Conflicts with name.
    pgp_key str
    PGP key to encrypt the resulting private key material. Only used when creating a new key pair.
    public_key str
    Public key material. This public key will be imported into Lightsail.
    tags Mapping[str, str]

    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Note: A PGP key is not required, however it is strongly encouraged. Without a PGP key, the private key material will be stored in state unencrypted. pgp_key is ignored if public_key is supplied.

    name String
    Name of the Lightsail Key Pair. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
    namePrefix String
    Creates a unique name beginning with the specified prefix. Conflicts with name.
    pgpKey String
    PGP key to encrypt the resulting private key material. Only used when creating a new key pair.
    publicKey String
    Public key material. This public key will be imported into Lightsail.
    tags Map<String>

    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Note: A PGP key is not required, however it is strongly encouraged. Without a PGP key, the private key material will be stored in state unencrypted. pgp_key is ignored if public_key is supplied.

    Outputs

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

    Arn string
    ARN of the Lightsail key pair.
    EncryptedFingerprint string
    MD5 public key fingerprint for the encrypted private key.
    EncryptedPrivateKey string
    Private key material, base 64 encoded and encrypted with the given pgp_key. This is only populated when creating a new key and pgp_key is supplied.
    Fingerprint string
    MD5 public key fingerprint as specified in section 4 of RFC 4716.
    Id string
    The provider-assigned unique ID for this managed resource.
    PrivateKey string
    Private key, base64 encoded. This is only populated when creating a new key, and when no pgp_key is provided.
    TagsAll Dictionary<string, string>
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Arn string
    ARN of the Lightsail key pair.
    EncryptedFingerprint string
    MD5 public key fingerprint for the encrypted private key.
    EncryptedPrivateKey string
    Private key material, base 64 encoded and encrypted with the given pgp_key. This is only populated when creating a new key and pgp_key is supplied.
    Fingerprint string
    MD5 public key fingerprint as specified in section 4 of RFC 4716.
    Id string
    The provider-assigned unique ID for this managed resource.
    PrivateKey string
    Private key, base64 encoded. This is only populated when creating a new key, and when no pgp_key is provided.
    TagsAll map[string]string
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    ARN of the Lightsail key pair.
    encryptedFingerprint String
    MD5 public key fingerprint for the encrypted private key.
    encryptedPrivateKey String
    Private key material, base 64 encoded and encrypted with the given pgp_key. This is only populated when creating a new key and pgp_key is supplied.
    fingerprint String
    MD5 public key fingerprint as specified in section 4 of RFC 4716.
    id String
    The provider-assigned unique ID for this managed resource.
    privateKey String
    Private key, base64 encoded. This is only populated when creating a new key, and when no pgp_key is provided.
    tagsAll Map<String,String>
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn string
    ARN of the Lightsail key pair.
    encryptedFingerprint string
    MD5 public key fingerprint for the encrypted private key.
    encryptedPrivateKey string
    Private key material, base 64 encoded and encrypted with the given pgp_key. This is only populated when creating a new key and pgp_key is supplied.
    fingerprint string
    MD5 public key fingerprint as specified in section 4 of RFC 4716.
    id string
    The provider-assigned unique ID for this managed resource.
    privateKey string
    Private key, base64 encoded. This is only populated when creating a new key, and when no pgp_key is provided.
    tagsAll {[key: string]: string}
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn str
    ARN of the Lightsail key pair.
    encrypted_fingerprint str
    MD5 public key fingerprint for the encrypted private key.
    encrypted_private_key str
    Private key material, base 64 encoded and encrypted with the given pgp_key. This is only populated when creating a new key and pgp_key is supplied.
    fingerprint str
    MD5 public key fingerprint as specified in section 4 of RFC 4716.
    id str
    The provider-assigned unique ID for this managed resource.
    private_key str
    Private key, base64 encoded. This is only populated when creating a new key, and when no pgp_key is provided.
    tags_all Mapping[str, str]
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    ARN of the Lightsail key pair.
    encryptedFingerprint String
    MD5 public key fingerprint for the encrypted private key.
    encryptedPrivateKey String
    Private key material, base 64 encoded and encrypted with the given pgp_key. This is only populated when creating a new key and pgp_key is supplied.
    fingerprint String
    MD5 public key fingerprint as specified in section 4 of RFC 4716.
    id String
    The provider-assigned unique ID for this managed resource.
    privateKey String
    Private key, base64 encoded. This is only populated when creating a new key, and when no pgp_key is provided.
    tagsAll Map<String>
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Look up Existing KeyPair Resource

    Get an existing KeyPair 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?: KeyPairState, opts?: CustomResourceOptions): KeyPair
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            arn: Optional[str] = None,
            encrypted_fingerprint: Optional[str] = None,
            encrypted_private_key: Optional[str] = None,
            fingerprint: Optional[str] = None,
            name: Optional[str] = None,
            name_prefix: Optional[str] = None,
            pgp_key: Optional[str] = None,
            private_key: Optional[str] = None,
            public_key: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            tags_all: Optional[Mapping[str, str]] = None) -> KeyPair
    func GetKeyPair(ctx *Context, name string, id IDInput, state *KeyPairState, opts ...ResourceOption) (*KeyPair, error)
    public static KeyPair Get(string name, Input<string> id, KeyPairState? state, CustomResourceOptions? opts = null)
    public static KeyPair get(String name, Output<String> id, KeyPairState state, CustomResourceOptions options)
    resources:  _:    type: aws:lightsail:KeyPair    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:
    Arn string
    ARN of the Lightsail key pair.
    EncryptedFingerprint string
    MD5 public key fingerprint for the encrypted private key.
    EncryptedPrivateKey string
    Private key material, base 64 encoded and encrypted with the given pgp_key. This is only populated when creating a new key and pgp_key is supplied.
    Fingerprint string
    MD5 public key fingerprint as specified in section 4 of RFC 4716.
    Name string
    Name of the Lightsail Key Pair. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
    NamePrefix string
    Creates a unique name beginning with the specified prefix. Conflicts with name.
    PgpKey string
    PGP key to encrypt the resulting private key material. Only used when creating a new key pair.
    PrivateKey string
    Private key, base64 encoded. This is only populated when creating a new key, and when no pgp_key is provided.
    PublicKey string
    Public key material. This public key will be imported into Lightsail.
    Tags Dictionary<string, string>

    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Note: A PGP key is not required, however it is strongly encouraged. Without a PGP key, the private key material will be stored in state unencrypted. pgp_key is ignored if public_key is supplied.

    TagsAll Dictionary<string, string>
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Arn string
    ARN of the Lightsail key pair.
    EncryptedFingerprint string
    MD5 public key fingerprint for the encrypted private key.
    EncryptedPrivateKey string
    Private key material, base 64 encoded and encrypted with the given pgp_key. This is only populated when creating a new key and pgp_key is supplied.
    Fingerprint string
    MD5 public key fingerprint as specified in section 4 of RFC 4716.
    Name string
    Name of the Lightsail Key Pair. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
    NamePrefix string
    Creates a unique name beginning with the specified prefix. Conflicts with name.
    PgpKey string
    PGP key to encrypt the resulting private key material. Only used when creating a new key pair.
    PrivateKey string
    Private key, base64 encoded. This is only populated when creating a new key, and when no pgp_key is provided.
    PublicKey string
    Public key material. This public key will be imported into Lightsail.
    Tags map[string]string

    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Note: A PGP key is not required, however it is strongly encouraged. Without a PGP key, the private key material will be stored in state unencrypted. pgp_key is ignored if public_key is supplied.

    TagsAll map[string]string
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    ARN of the Lightsail key pair.
    encryptedFingerprint String
    MD5 public key fingerprint for the encrypted private key.
    encryptedPrivateKey String
    Private key material, base 64 encoded and encrypted with the given pgp_key. This is only populated when creating a new key and pgp_key is supplied.
    fingerprint String
    MD5 public key fingerprint as specified in section 4 of RFC 4716.
    name String
    Name of the Lightsail Key Pair. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
    namePrefix String
    Creates a unique name beginning with the specified prefix. Conflicts with name.
    pgpKey String
    PGP key to encrypt the resulting private key material. Only used when creating a new key pair.
    privateKey String
    Private key, base64 encoded. This is only populated when creating a new key, and when no pgp_key is provided.
    publicKey String
    Public key material. This public key will be imported into Lightsail.
    tags Map<String,String>

    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Note: A PGP key is not required, however it is strongly encouraged. Without a PGP key, the private key material will be stored in state unencrypted. pgp_key is ignored if public_key is supplied.

    tagsAll Map<String,String>
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn string
    ARN of the Lightsail key pair.
    encryptedFingerprint string
    MD5 public key fingerprint for the encrypted private key.
    encryptedPrivateKey string
    Private key material, base 64 encoded and encrypted with the given pgp_key. This is only populated when creating a new key and pgp_key is supplied.
    fingerprint string
    MD5 public key fingerprint as specified in section 4 of RFC 4716.
    name string
    Name of the Lightsail Key Pair. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
    namePrefix string
    Creates a unique name beginning with the specified prefix. Conflicts with name.
    pgpKey string
    PGP key to encrypt the resulting private key material. Only used when creating a new key pair.
    privateKey string
    Private key, base64 encoded. This is only populated when creating a new key, and when no pgp_key is provided.
    publicKey string
    Public key material. This public key will be imported into Lightsail.
    tags {[key: string]: string}

    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Note: A PGP key is not required, however it is strongly encouraged. Without a PGP key, the private key material will be stored in state unencrypted. pgp_key is ignored if public_key is supplied.

    tagsAll {[key: string]: string}
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn str
    ARN of the Lightsail key pair.
    encrypted_fingerprint str
    MD5 public key fingerprint for the encrypted private key.
    encrypted_private_key str
    Private key material, base 64 encoded and encrypted with the given pgp_key. This is only populated when creating a new key and pgp_key is supplied.
    fingerprint str
    MD5 public key fingerprint as specified in section 4 of RFC 4716.
    name str
    Name of the Lightsail Key Pair. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
    name_prefix str
    Creates a unique name beginning with the specified prefix. Conflicts with name.
    pgp_key str
    PGP key to encrypt the resulting private key material. Only used when creating a new key pair.
    private_key str
    Private key, base64 encoded. This is only populated when creating a new key, and when no pgp_key is provided.
    public_key str
    Public key material. This public key will be imported into Lightsail.
    tags Mapping[str, str]

    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Note: A PGP key is not required, however it is strongly encouraged. Without a PGP key, the private key material will be stored in state unencrypted. pgp_key is ignored if public_key is supplied.

    tags_all Mapping[str, str]
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    ARN of the Lightsail key pair.
    encryptedFingerprint String
    MD5 public key fingerprint for the encrypted private key.
    encryptedPrivateKey String
    Private key material, base 64 encoded and encrypted with the given pgp_key. This is only populated when creating a new key and pgp_key is supplied.
    fingerprint String
    MD5 public key fingerprint as specified in section 4 of RFC 4716.
    name String
    Name of the Lightsail Key Pair. If omitted, the provider will assign a random, unique name. Conflicts with name_prefix.
    namePrefix String
    Creates a unique name beginning with the specified prefix. Conflicts with name.
    pgpKey String
    PGP key to encrypt the resulting private key material. Only used when creating a new key pair.
    privateKey String
    Private key, base64 encoded. This is only populated when creating a new key, and when no pgp_key is provided.
    publicKey String
    Public key material. This public key will be imported into Lightsail.
    tags Map<String>

    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Note: A PGP key is not required, however it is strongly encouraged. Without a PGP key, the private key material will be stored in state unencrypted. pgp_key is ignored if public_key is supplied.

    tagsAll Map<String>
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Import

    You cannot import Lightsail Key Pairs because the private and public key are only available on initial creation.

    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