Show / Hide Table of Contents

Class KeyPair

Provides an EC2 key pair resource. A key pair is used to control login access to EC2 instances.

Currently this resource requires an existing user-supplied key pair. This key pair's public key will be registered with AWS to allow logging-in to EC2 instances.

When importing an existing key pair the public key material may be in any format supported by AWS. Supported formats (per the AWS documentation) are:

  • OpenSSH public key format (the format in ~/.ssh/authorized_keys)
  • Base64 encoded DER format
  • SSH public key file format as specified in RFC4716

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var deployer = new Aws.Ec2.KeyPair("deployer", new Aws.Ec2.KeyPairArgs
    {
        PublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com",
    });
}

}
Inheritance
System.Object
Resource
CustomResource
KeyPair
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Aws.Ec2
Assembly: Pulumi.Aws.dll
Syntax
public class KeyPair : CustomResource

Constructors

View Source

KeyPair(String, KeyPairArgs, CustomResourceOptions)

Create a KeyPair resource with the given unique name, arguments, and options.

Declaration
public KeyPair(string name, KeyPairArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

KeyPairArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

Fingerprint

The MD5 public key fingerprint as specified in section 4 of RFC 4716.

Declaration
public Output<string> Fingerprint { get; }
Property Value
Type Description
Output<System.String>
View Source

KeyName

The name for the key pair.

Declaration
public Output<string> KeyName { get; }
Property Value
Type Description
Output<System.String>
View Source

KeyNamePrefix

Creates a unique name beginning with the specified prefix. Conflicts with key_name.

Declaration
public Output<string> KeyNamePrefix { get; }
Property Value
Type Description
Output<System.String>
View Source

KeyPairId

The key pair ID.

Declaration
public Output<string> KeyPairId { get; }
Property Value
Type Description
Output<System.String>
View Source

PublicKey

The public key material.

Declaration
public Output<string> PublicKey { get; }
Property Value
Type Description
Output<System.String>
View Source

Tags

Key-value map of resource tags

Declaration
public Output<ImmutableDictionary<string, object>> Tags { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>>

Methods

View Source

Get(String, Input<String>, KeyPairState, CustomResourceOptions)

Get an existing KeyPair resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static KeyPair Get(string name, Input<string> id, KeyPairState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

KeyPairState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
KeyPair
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.