AWS Security ChangesHomeSearch

AWS ec2: Update create-key-pair example and add output

Service: ec2 · 2026-10-31 · Documentation low

File: ec2/latest/devguide/example_ec2_CreateKeyPair_section.md

Summary

Rewords the create-key-pair example, reformats the command, adds sample JSON output including KeyMaterial, and updates the reference link.

Security assessment

The example output uses clearly fake key material and is a documentation formatting/example update; it does not address a vulnerability or add new security guidance.

Evidence

+        "KeyMaterial": "-----BEGIN RSA PRIVATE KEY-----\nEXAMPLEKEYMATERIAL\n-----END RSA PRIVATE KEY-----",

Diff

diff --git a/ec2/latest/devguide/example_ec2_CreateKeyPair_section.md b/ec2/latest/devguide/example_ec2_CreateKeyPair_section.md
index 1429674..48f8452 100644
--- a//ec2/latest/devguide/example_ec2_CreateKeyPair_section.md
+++ b//ec2/latest/devguide/example_ec2_CreateKeyPair_section.md
@@ -318 +318 @@ CLI
-This example creates a key pair named `MyKeyPair`.
+The following `create-key-pair` example creates a key pair named `MyKeyPair`.
@@ -320 +319,0 @@ This example creates a key pair named `MyKeyPair`.
-Command:
@@ -322,2 +321,2 @@ Command:
-    
-    aws ec2 create-key-pair --key-name MyKeyPair
+    aws ec2 create-key-pair \
+        --key-name MyKeyPair
@@ -328 +327,11 @@ The output is an ASCII version of the private key and key fingerprint. You need
-For more information, see Using Key Pairs in the _AWS Command Line Interface User Guide_.
+Output:
+    
+    
+    {
+        "KeyFingerprint": "1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f",
+        "KeyMaterial": "-----BEGIN RSA PRIVATE KEY-----\nEXAMPLEKEYMATERIAL\n-----END RSA PRIVATE KEY-----",
+        "KeyName": "MyKeyPair",
+        "KeyPairId": "key-0b94643da6EXAMPLE"
+    }
+
+For more information, see [Creating, displaying, and deleting Amazon EC2 key pairs in the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-services-ec2-keypairs.html) in the _AWS Command Line Interface User Guide_.