AWS SDK for .NET Documentation
CreateKeyPair Method (request)
Amazon ► Amazon.EC2 ► AmazonEC2 ► CreateKeyPair(CreateKeyPairRequest)
Did this page help you? Yes No Tell us about it...
Creates a new 2048-bit RSA key pair with the specified name. The public key is stored by Amazon EC2 and the private key is returned to you.
Declaration Syntax

C#

    CreateKeyPairResponse CreateKeyPair(
    	CreateKeyPairRequest request
    )

Parameters

request (CreateKeyPairRequest)
  Create Key Pair request

Return Value
Create Key Pair Response from the service
Remarks
The private key is returned as an unencrypted PEM encoded PKCS#8 private key. If a key with the specified name already exists, Amazon EC2 returns an error. The key pair returned to you works only in the Region you're using when you create the key pair. To create a key pair that works in all Regions, use ImportKeyPair.
Exceptions

Exception | Condition
--- | ---
WebException |
AmazonEC2Exception |

Assembly: AWSSDK (Module: AWSSDK) Version: 1.5.60.0 (1.5.60.0)