Package com.pulumi.aws.lightsail
Class KeyPair
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.lightsail.KeyPair
-
public class KeyPair extends com.pulumi.resources.CustomResourceManages 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"](https://lightsail.aws.amazon.com/ls/docs/overview/article/understanding-regions-and-availability-zones-in-amazon-lightsail) for more details ## Example Usage ### Create New Key Pair
### Create New Key Pair with PGP Encrypted Private Keypackage 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.ArrayList; import java.util.Arrays; 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()); } }
### Existing Public Key Importpackage 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.ArrayList; import java.util.Arrays; 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()); } }
## Import You cannot import Lightsail Key Pairs because the private and public key are only available on initial creation.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.ArrayList; import java.util.Arrays; 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()); } }
-
-
Constructor Summary
Constructors Constructor Description KeyPair(java.lang.String name)KeyPair(java.lang.String name, KeyPairArgs args)KeyPair(java.lang.String name, KeyPairArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.String>arn()com.pulumi.core.Output<java.lang.String>encryptedFingerprint()com.pulumi.core.Output<java.lang.String>encryptedPrivateKey()com.pulumi.core.Output<java.lang.String>fingerprint()static KeyPairget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, KeyPairState state, com.pulumi.resources.CustomResourceOptions options)Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>name()com.pulumi.core.Output<java.lang.String>namePrefix()com.pulumi.core.Output<java.util.Optional<java.lang.String>>pgpKey()com.pulumi.core.Output<java.lang.String>privateKey()com.pulumi.core.Output<java.lang.String>publicKey()com.pulumi.core.Output<java.lang.String>region()com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>>tags()com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>>tagsAll()
-
-
-
Constructor Detail
-
KeyPair
public KeyPair(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
KeyPair
public KeyPair(java.lang.String name, @Nullable KeyPairArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
KeyPair
public KeyPair(java.lang.String name, @Nullable KeyPairArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.options- A bag of options that control this resource's behavior.
-
-
Method Detail
-
arn
public com.pulumi.core.Output<java.lang.String> arn()
- Returns:
- ARN of the Lightsail key pair.
-
encryptedFingerprint
public com.pulumi.core.Output<java.lang.String> encryptedFingerprint()
- Returns:
- MD5 public key fingerprint for the encrypted private key.
-
encryptedPrivateKey
public com.pulumi.core.Output<java.lang.String> encryptedPrivateKey()
- Returns:
- Private key material, base 64 encoded and encrypted with the given `pgpKey`. This is only populated when creating a new key and `pgpKey` is supplied.
-
fingerprint
public com.pulumi.core.Output<java.lang.String> fingerprint()
- Returns:
- MD5 public key fingerprint as specified in section 4 of RFC 4716.
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- Name of the Lightsail Key Pair. If omitted, the provider will assign a random, unique name. Conflicts with `namePrefix`.
-
namePrefix
public com.pulumi.core.Output<java.lang.String> namePrefix()
- Returns:
- Creates a unique name beginning with the specified prefix. Conflicts with `name`.
-
pgpKey
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> pgpKey()
- Returns:
- PGP key to encrypt the resulting private key material. Only used when creating a new key pair.
-
privateKey
public com.pulumi.core.Output<java.lang.String> privateKey()
- Returns:
- Private key, base64 encoded. This is only populated when creating a new key, and when no `pgpKey` is provided.
-
publicKey
public com.pulumi.core.Output<java.lang.String> publicKey()
- Returns:
- Public key material. This public key will be imported into Lightsail.
-
region
public com.pulumi.core.Output<java.lang.String> region()
- Returns:
- Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
-
tags
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>> tags()
- Returns:
- 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 `defaultTags` 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. `pgpKey` is ignored if `publicKey` is supplied.
-
tagsAll
public com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>> tagsAll()
- Returns:
- Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
-
get
public static KeyPair get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable KeyPairState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name- The _unique_ name of the resulting resource.id- The _unique_ provider ID of the resource to lookup.state-options- Optional settings to control the behavior of the CustomResource.
-
-