AWS Security ChangesHomeSearch

AWS ec2 documentation change

Service: ec2 · 2025-06-28 · Documentation low

File: ec2/latest/devguide/example_ec2_ImportKeyPair_section.md

Summary

Added PowerShell V5 examples for ImportKeyPair operation with public key conversion

Security assessment

The change documents key pair management processes, which is a security feature, but does not address specific vulnerabilities

Diff

diff --git a/ec2/latest/devguide/example_ec2_ImportKeyPair_section.md b/ec2/latest/devguide/example_ec2_ImportKeyPair_section.md
index 0ff068b61..16a922838 100644
--- a//ec2/latest/devguide/example_ec2_ImportKeyPair_section.md
+++ b//ec2/latest/devguide/example_ec2_ImportKeyPair_section.md
@@ -80,0 +81,23 @@ PowerShell
+**Tools for PowerShell V5**
+    
+
+**Example 1: This example imports a public key to EC2. The first line stores the contents of the public key file (*.pub) in the variable`$publickey`. Next, the example converts the UTF8 format of the public key file to a Base64-encoded string, and stores the converted string in the variable `$pkbase64`. In the last line, the converted public key is imported to EC2. The cmdlet returns the key fingerprint and name as results.**
+    
+    
+    $publickey=[Io.File]::ReadAllText("C:\Users\TestUser\.ssh\id_rsa.pub")
+    $pkbase64 = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($publickey))
+    Import-EC2KeyPair -KeyName Example-user-key -PublicKey $pkbase64
+    
+
+**Output:**
+    
+    
+    KeyFingerprint                                  KeyName
+    --------------                                  -------
+    do:d0:15:8f:79:97:12:be:00:fd:df:31:z3:b1:42:z1 Example-user-key
+
+  * For API details, see [ImportKeyPair](https://docs.aws.amazon.com/powershell/v5/reference) in _AWS Tools for PowerShell Cmdlet Reference (V5)_. 
+
+
+
+