Class CfnKeyPair
A CloudFormation AWS::EC2::KeyPair
.
Inherited Members
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.AWS.EC2.dll
Syntax (csharp)
public class CfnKeyPair : CfnResource, IConstruct, IDependable, IInspectable
Syntax (vb)
Public Class CfnKeyPair
Inherits CfnResource
Implements IConstruct, IDependable, IInspectable
Remarks
Specifies a key pair for use with an Amazon Elastic Compute Cloud instance as follows:
When you import an existing key pair, you specify the public key material for the key. We assume that you have the private key material for the key. AWS CloudFormation does not create or return the private key material when you import a key pair.
When you create a new key pair, the private key is saved to AWS Systems Manager Parameter Store, using a parameter with the following name: /ec2/keypair/{key_pair_id}
. For more information about retrieving private key, and the required permissions, see Create a key pair using AWS CloudFormation in the Amazon EC2 User Guide .
When AWS CloudFormation deletes a key pair that was created or imported by a stack, it also deletes the parameter that was used to store the private key material in Parameter Store.
CloudformationResource: AWS::EC2::KeyPair
Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-keypair.html
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;
var cfnKeyPair = new CfnKeyPair(this, "MyCfnKeyPair", new CfnKeyPairProps {
KeyName = "keyName",
// the properties below are optional
KeyType = "keyType",
PublicKeyMaterial = "publicKeyMaterial",
Tags = new [] { new CfnTag {
Key = "key",
Value = "value"
} }
});
Synopsis
Constructors
CfnKeyPair(Construct, String, ICfnKeyPairProps) | Create a new |
CfnKeyPair(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CfnKeyPair(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
AttrKeyFingerprint | If you created the key pair using Amazon EC2:. |
AttrKeyPairId | The ID of the key pair. |
CFN_RESOURCE_TYPE_NAME | The CloudFormation resource type name for this resource class. |
CfnProperties | |
KeyName | A unique name for the key pair. |
KeyType | The type of key pair. Note that ED25519 keys are not supported for Windows instances. |
PublicKeyMaterial | The public key material. |
Tags | The tags to apply to the key pair. |
Methods
Inspect(TreeInspector) | Examines the CloudFormation resource and discloses attributes. |
RenderProperties(IDictionary<String, Object>) |
Constructors
CfnKeyPair(Construct, String, ICfnKeyPairProps)
Create a new AWS::EC2::KeyPair
.
public CfnKeyPair(Construct scope, string id, ICfnKeyPairProps props)
Parameters
- scope Construct
- scope in which this resource is defined.
- id System.String
- scoped id of the resource.
- props ICfnKeyPairProps
- resource properties.
CfnKeyPair(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CfnKeyPair(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CfnKeyPair(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CfnKeyPair(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
AttrKeyFingerprint
If you created the key pair using Amazon EC2:.
public virtual string AttrKeyFingerprint { get; }
Property Value
System.String
Remarks
If you imported the key pair to Amazon EC2:
CloudformationAttribute: KeyFingerprint
AttrKeyPairId
The ID of the key pair.
public virtual string AttrKeyPairId { get; }
Property Value
System.String
Remarks
CloudformationAttribute: KeyPairId
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
public static string CFN_RESOURCE_TYPE_NAME { get; }
Property Value
System.String
CfnProperties
protected override IDictionary<string, object> CfnProperties { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.Object>
Overrides
KeyName
A unique name for the key pair.
public virtual string KeyName { get; set; }
Property Value
System.String
Remarks
Constraints: Up to 255 ASCII characters
KeyType
The type of key pair. Note that ED25519 keys are not supported for Windows instances.
public virtual string KeyType { get; set; }
Property Value
System.String
Remarks
If the PublicKeyMaterial
property is specified, the KeyType
property is ignored, and the key type is inferred from the PublicKeyMaterial
value.
Default: rsa
PublicKeyMaterial
The public key material.
public virtual string PublicKeyMaterial { get; set; }
Property Value
System.String
Remarks
The PublicKeyMaterial
property is used to import a key pair. If this property is not specified, then a new key pair will be created.
Tags
The tags to apply to the key pair.
public virtual TagManager Tags { get; }
Property Value
Remarks
Methods
Inspect(TreeInspector)
Examines the CloudFormation resource and discloses attributes.
public virtual void Inspect(TreeInspector inspector)
Parameters
- inspector TreeInspector
- tree inspector to collect and process attributes.
RenderProperties(IDictionary<String, Object>)
protected override IDictionary<string, object> RenderProperties(IDictionary<string, object> props)
Parameters
- props System.Collections.Generic.IDictionary<System.String, System.Object>
Returns
System.Collections.Generic.IDictionary<System.String, System.Object>