@Generated(value="jsii-pacmak/1.60.0 (build ebcefe6)", date="2022-06-22T23:27:54.911Z") public class CfnKeyPair extends CfnResource implements IInspectable
Specifies a key pair for an Amazon EC2 instance. The key pair can either be imported or created by Amazon EC2, as follows:
PublicKeyMaterial
property in the template.PublicKeyMaterial
property. When Amazon EC2 creates a new key pair, the private key is saved to an AWS Systems Manager Parameter Store. The name of the Systems Manager parameter follows the format /ec2/keypair/{key_pair_id}
. For more information, see AWS Systems Manager Parameter Store in the AWS Systems Manager User Guide .For more information, see Amazon EC2 key pairs in the Amazon EC2 User Guide .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.services.ec2.*; CfnKeyPair cfnKeyPair = CfnKeyPair.Builder.create(this, "MyCfnKeyPair") .keyName("keyName") // the properties below are optional .keyType("keyType") .publicKeyMaterial("publicKeyMaterial") .tags(List.of(CfnTag.builder() .key("key") .value("value") .build())) .build();
Modifier and Type | Class and Description |
---|---|
static class |
CfnKeyPair.Builder
A fluent builder for
CfnKeyPair . |
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
IConstruct.Jsii$Default
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
Modifier | Constructor and Description |
---|---|
|
CfnKeyPair(Construct scope,
java.lang.String id,
CfnKeyPairProps props)
Create a new `AWS::EC2::KeyPair`.
|
protected |
CfnKeyPair(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnKeyPair(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAttrKeyFingerprint()
If you created the key pair using Amazon EC2:.
|
java.lang.String |
getAttrKeyPairId()
The ID of the key pair.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getCfnProperties() |
java.lang.String |
getKeyName()
A unique name for the key pair.
|
java.lang.String |
getKeyType()
The type of key pair.
|
java.lang.String |
getPublicKeyMaterial()
The public key material.
|
TagManager |
getTags()
The tags to apply to the key pair.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
renderProperties(java.util.Map<java.lang.String,java.lang.Object> props) |
void |
setKeyName(java.lang.String value)
A unique name for the key pair.
|
void |
setKeyType(java.lang.String value)
The type of key pair.
|
void |
setPublicKeyMaterial(java.lang.String value)
The public key material.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
getRef
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
public static final java.lang.String CFN_RESOURCE_TYPE_NAME
protected CfnKeyPair(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnKeyPair(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CfnKeyPair(Construct scope, java.lang.String id, CfnKeyPairProps props)
scope
- - scope in which this resource is defined. This parameter is required.id
- - scoped id of the resource. This parameter is required.props
- - resource properties. This parameter is required.public void inspect(TreeInspector inspector)
inspect
in interface IInspectable
inspector
- - tree inspector to collect and process attributes. This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> renderProperties(java.util.Map<java.lang.String,java.lang.Object> props)
renderProperties
in class CfnResource
props
- This parameter is required.public java.lang.String getAttrKeyFingerprint()
If you imported the key pair to Amazon EC2:
public java.lang.String getAttrKeyPairId()
protected java.util.Map<java.lang.String,java.lang.Object> getCfnProperties()
getCfnProperties
in class CfnResource
public TagManager getTags()
public java.lang.String getKeyName()
Constraints: Up to 255 ASCII characters
public void setKeyName(java.lang.String value)
Constraints: Up to 255 ASCII characters
public java.lang.String getKeyType()
If the PublicKeyMaterial
property is specified, the KeyType
property is ignored, and the key type is inferred from the PublicKeyMaterial
value.
Default: rsa
public void setKeyType(java.lang.String value)
If the PublicKeyMaterial
property is specified, the KeyType
property is ignored, and the key type is inferred from the PublicKeyMaterial
value.
Default: rsa
public java.lang.String getPublicKeyMaterial()
The PublicKeyMaterial
property is used to import a key pair. If this property is not specified, then a new key pair will be created.
public void setPublicKeyMaterial(java.lang.String value)
The PublicKeyMaterial
property is used to import a key pair. If this property is not specified, then a new key pair will be created.