AWS Native is in preview. AWS Classic is fully supported.
AWS Native v0.100.0 published on Wednesday, Mar 27, 2024 by Pulumi
aws-native.ec2.KeyPair
Explore with Pulumi AI
AWS Native is in preview. AWS Classic is fully supported.
AWS Native v0.100.0 published on Wednesday, Mar 27, 2024 by Pulumi
The AWS::EC2::KeyPair creates an SSH key pair
Example Usage
Example
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;
return await Deployment.RunAsync(() =>
{
var newKeyPair = new AwsNative.Ec2.KeyPair("newKeyPair", new()
{
KeyName = "MyKeyPair",
});
var ec2Instance = new AwsNative.Ec2.Instance("ec2Instance", new()
{
ImageId = "ami-02b92c281a4d3dc79",
KeyName = newKeyPair.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-aws-native/sdk/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
newKeyPair, err := ec2.NewKeyPair(ctx, "newKeyPair", &ec2.KeyPairArgs{
KeyName: pulumi.String("MyKeyPair"),
})
if err != nil {
return err
}
_, err = ec2.NewInstance(ctx, "ec2Instance", &ec2.InstanceArgs{
ImageId: pulumi.String("ami-02b92c281a4d3dc79"),
KeyName: newKeyPair.ID(),
})
if err != nil {
return err
}
return nil
})
}
Coming soon!
import pulumi
import pulumi_aws_native as aws_native
new_key_pair = aws_native.ec2.KeyPair("newKeyPair", key_name="MyKeyPair")
ec2_instance = aws_native.ec2.Instance("ec2Instance",
image_id="ami-02b92c281a4d3dc79",
key_name=new_key_pair.id)
import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";
const newKeyPair = new aws_native.ec2.KeyPair("newKeyPair", {keyName: "MyKeyPair"});
const ec2Instance = new aws_native.ec2.Instance("ec2Instance", {
imageId: "ami-02b92c281a4d3dc79",
keyName: newKeyPair.id,
});
Coming soon!
Example
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;
return await Deployment.RunAsync(() =>
{
var newKeyPair = new AwsNative.Ec2.KeyPair("newKeyPair", new()
{
KeyName = "MyKeyPair",
});
var ec2Instance = new AwsNative.Ec2.Instance("ec2Instance", new()
{
ImageId = "ami-02b92c281a4d3dc79",
KeyName = newKeyPair.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-aws-native/sdk/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
newKeyPair, err := ec2.NewKeyPair(ctx, "newKeyPair", &ec2.KeyPairArgs{
KeyName: pulumi.String("MyKeyPair"),
})
if err != nil {
return err
}
_, err = ec2.NewInstance(ctx, "ec2Instance", &ec2.InstanceArgs{
ImageId: pulumi.String("ami-02b92c281a4d3dc79"),
KeyName: newKeyPair.ID(),
})
if err != nil {
return err
}
return nil
})
}
Coming soon!
import pulumi
import pulumi_aws_native as aws_native
new_key_pair = aws_native.ec2.KeyPair("newKeyPair", key_name="MyKeyPair")
ec2_instance = aws_native.ec2.Instance("ec2Instance",
image_id="ami-02b92c281a4d3dc79",
key_name=new_key_pair.id)
import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";
const newKeyPair = new aws_native.ec2.KeyPair("newKeyPair", {keyName: "MyKeyPair"});
const ec2Instance = new aws_native.ec2.Instance("ec2Instance", {
imageId: "ami-02b92c281a4d3dc79",
keyName: newKeyPair.id,
});
Coming soon!
Example
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;
return await Deployment.RunAsync(() =>
{
var importedKeyPair = new AwsNative.Ec2.KeyPair("importedKeyPair", new()
{
KeyName = "NameForMyImportedKeyPair",
PublicKeyMaterial = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICfp1F7DhdWZdqkYAUGCzcBsLmJeu9izpIyGpmmg7eCz example",
});
var ec2Instance = new AwsNative.Ec2.Instance("ec2Instance", new()
{
ImageId = "ami-02b92c281a4d3dc79",
KeyName = importedKeyPair.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-aws-native/sdk/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
importedKeyPair, err := ec2.NewKeyPair(ctx, "importedKeyPair", &ec2.KeyPairArgs{
KeyName: pulumi.String("NameForMyImportedKeyPair"),
PublicKeyMaterial: pulumi.String("ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICfp1F7DhdWZdqkYAUGCzcBsLmJeu9izpIyGpmmg7eCz example"),
})
if err != nil {
return err
}
_, err = ec2.NewInstance(ctx, "ec2Instance", &ec2.InstanceArgs{
ImageId: pulumi.String("ami-02b92c281a4d3dc79"),
KeyName: importedKeyPair.ID(),
})
if err != nil {
return err
}
return nil
})
}
Coming soon!
import pulumi
import pulumi_aws_native as aws_native
imported_key_pair = aws_native.ec2.KeyPair("importedKeyPair",
key_name="NameForMyImportedKeyPair",
public_key_material="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICfp1F7DhdWZdqkYAUGCzcBsLmJeu9izpIyGpmmg7eCz example")
ec2_instance = aws_native.ec2.Instance("ec2Instance",
image_id="ami-02b92c281a4d3dc79",
key_name=imported_key_pair.id)
import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";
const importedKeyPair = new aws_native.ec2.KeyPair("importedKeyPair", {
keyName: "NameForMyImportedKeyPair",
publicKeyMaterial: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICfp1F7DhdWZdqkYAUGCzcBsLmJeu9izpIyGpmmg7eCz example",
});
const ec2Instance = new aws_native.ec2.Instance("ec2Instance", {
imageId: "ami-02b92c281a4d3dc79",
keyName: importedKeyPair.id,
});
Coming soon!
Example
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;
return await Deployment.RunAsync(() =>
{
var importedKeyPair = new AwsNative.Ec2.KeyPair("importedKeyPair", new()
{
KeyName = "NameForMyImportedKeyPair",
PublicKeyMaterial = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICfp1F7DhdWZdqkYAUGCzcBsLmJeu9izpIyGpmmg7eCz example",
});
var ec2Instance = new AwsNative.Ec2.Instance("ec2Instance", new()
{
ImageId = "ami-02b92c281a4d3dc79",
KeyName = importedKeyPair.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-aws-native/sdk/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
importedKeyPair, err := ec2.NewKeyPair(ctx, "importedKeyPair", &ec2.KeyPairArgs{
KeyName: pulumi.String("NameForMyImportedKeyPair"),
PublicKeyMaterial: pulumi.String("ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICfp1F7DhdWZdqkYAUGCzcBsLmJeu9izpIyGpmmg7eCz example"),
})
if err != nil {
return err
}
_, err = ec2.NewInstance(ctx, "ec2Instance", &ec2.InstanceArgs{
ImageId: pulumi.String("ami-02b92c281a4d3dc79"),
KeyName: importedKeyPair.ID(),
})
if err != nil {
return err
}
return nil
})
}
Coming soon!
import pulumi
import pulumi_aws_native as aws_native
imported_key_pair = aws_native.ec2.KeyPair("importedKeyPair",
key_name="NameForMyImportedKeyPair",
public_key_material="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICfp1F7DhdWZdqkYAUGCzcBsLmJeu9izpIyGpmmg7eCz example")
ec2_instance = aws_native.ec2.Instance("ec2Instance",
image_id="ami-02b92c281a4d3dc79",
key_name=imported_key_pair.id)
import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";
const importedKeyPair = new aws_native.ec2.KeyPair("importedKeyPair", {
keyName: "NameForMyImportedKeyPair",
publicKeyMaterial: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICfp1F7DhdWZdqkYAUGCzcBsLmJeu9izpIyGpmmg7eCz example",
});
const ec2Instance = new aws_native.ec2.Instance("ec2Instance", {
imageId: "ami-02b92c281a4d3dc79",
keyName: importedKeyPair.id,
});
Coming soon!
Create KeyPair Resource
new KeyPair(name: string, args: KeyPairArgs, opts?: CustomResourceOptions);
@overload
def KeyPair(resource_name: str,
opts: Optional[ResourceOptions] = None,
key_format: Optional[KeyPairKeyFormat] = None,
key_name: Optional[str] = None,
key_type: Optional[KeyPairKeyType] = None,
public_key_material: Optional[str] = None,
tags: Optional[Sequence[_root_inputs.CreateOnlyTagArgs]] = None)
@overload
def KeyPair(resource_name: str,
args: KeyPairArgs,
opts: Optional[ResourceOptions] = None)
func NewKeyPair(ctx *Context, name string, args KeyPairArgs, opts ...ResourceOption) (*KeyPair, error)
public KeyPair(string name, KeyPairArgs args, CustomResourceOptions? opts = null)
public KeyPair(String name, KeyPairArgs args)
public KeyPair(String name, KeyPairArgs args, CustomResourceOptions options)
type: aws-native:ec2:KeyPair
properties: # The arguments to resource properties.
options: # 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.
- 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.
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
The KeyPair resource accepts the following input properties:
- Key
Name string - The name of the SSH key pair
- Key
Format Pulumi.Aws Native. Ec2. Key Pair Key Format - The format of the private key
- Key
Type Pulumi.Aws Native. Ec2. Key Pair Key Type - The crypto-system used to generate a key pair.
- Public
Key stringMaterial - Plain text public key to import
- List<Pulumi.
Aws Native. Inputs. Create Only Tag> - An array of key-value pairs to apply to this resource.
- Key
Name string - The name of the SSH key pair
- Key
Format KeyPair Key Format - The format of the private key
- Key
Type KeyPair Key Type - The crypto-system used to generate a key pair.
- Public
Key stringMaterial - Plain text public key to import
- Create
Only Tag Args - An array of key-value pairs to apply to this resource.
- key
Name String - The name of the SSH key pair
- key
Format KeyPair Key Format - The format of the private key
- key
Type KeyPair Key Type - The crypto-system used to generate a key pair.
- public
Key StringMaterial - Plain text public key to import
- List<Create
Only Tag> - An array of key-value pairs to apply to this resource.
- key
Name string - The name of the SSH key pair
- key
Format KeyPair Key Format - The format of the private key
- key
Type KeyPair Key Type - The crypto-system used to generate a key pair.
- public
Key stringMaterial - Plain text public key to import
- Create
Only Tag[] - An array of key-value pairs to apply to this resource.
- key_
name str - The name of the SSH key pair
- key_
format KeyPair Key Format - The format of the private key
- key_
type KeyPair Key Type - The crypto-system used to generate a key pair.
- public_
key_ strmaterial - Plain text public key to import
- Create
Only Tag Args] - An array of key-value pairs to apply to this resource.
- key
Name String - The name of the SSH key pair
- key
Format "pem" | "ppk" - The format of the private key
- key
Type "rsa" | "ed25519" - The crypto-system used to generate a key pair.
- public
Key StringMaterial - Plain text public key to import
- List<Property Map>
- An array of key-value pairs to apply to this resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the KeyPair resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Key
Fingerprint string - A short sequence of bytes used for public key verification
- Key
Pair stringId - An AWS generated ID for the key pair
- Id string
- The provider-assigned unique ID for this managed resource.
- Key
Fingerprint string - A short sequence of bytes used for public key verification
- Key
Pair stringId - An AWS generated ID for the key pair
- id String
- The provider-assigned unique ID for this managed resource.
- key
Fingerprint String - A short sequence of bytes used for public key verification
- key
Pair StringId - An AWS generated ID for the key pair
- id string
- The provider-assigned unique ID for this managed resource.
- key
Fingerprint string - A short sequence of bytes used for public key verification
- key
Pair stringId - An AWS generated ID for the key pair
- id str
- The provider-assigned unique ID for this managed resource.
- key_
fingerprint str - A short sequence of bytes used for public key verification
- key_
pair_ strid - An AWS generated ID for the key pair
- id String
- The provider-assigned unique ID for this managed resource.
- key
Fingerprint String - A short sequence of bytes used for public key verification
- key
Pair StringId - An AWS generated ID for the key pair
Supporting Types
CreateOnlyTag, CreateOnlyTagArgs
KeyPairKeyFormat, KeyPairKeyFormatArgs
- Pem
- pem
- Ppk
- ppk
- Key
Pair Key Format Pem - pem
- Key
Pair Key Format Ppk - ppk
- Pem
- pem
- Ppk
- ppk
- Pem
- pem
- Ppk
- ppk
- PEM
- pem
- PPK
- ppk
- "pem"
- pem
- "ppk"
- ppk
KeyPairKeyType, KeyPairKeyTypeArgs
- Rsa
- rsa
- Ed25519
- ed25519
- Key
Pair Key Type Rsa - rsa
- Key
Pair Key Type Ed25519 - ed25519
- Rsa
- rsa
- Ed25519
- ed25519
- Rsa
- rsa
- Ed25519
- ed25519
- RSA
- rsa
- ED25519
- ed25519
- "rsa"
- rsa
- "ed25519"
- ed25519
Package Details
- Repository
- AWS Native pulumi/pulumi-aws-native
- License
- Apache-2.0
AWS Native is in preview. AWS Classic is fully supported.
AWS Native v0.100.0 published on Wednesday, Mar 27, 2024 by Pulumi