AWS AWSEC2 documentation change
Summary
Condensed CLI/PowerShell command explanations, added concrete examples for key pair import/describe operations, and improved code formatting
Security assessment
Changes improve documentation for key pair management (security-sensitive feature) but show no evidence of addressing a specific vulnerability. Added examples enhance clarity around security controls but don't introduce new security features.
Diff
diff --git a/AWSEC2/latest/UserGuide/create-key-pairs.md b/AWSEC2/latest/UserGuide/create-key-pairs.md index edda10006..8dfaad5d7 100644 --- a//AWSEC2/latest/UserGuide/create-key-pairs.md +++ b//AWSEC2/latest/UserGuide/create-key-pairs.md @@ -77,11 +77 @@ AWS CLI - 1. Use the [create-key-pair](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/create-key-pair.html) command as follows to generate the key pair and to save the private key to a `.pem` file. - -For `--key-name`, specify a name for the public key. The name can be up to 255 ASCII characters. - -For `--key-type`, specify either `rsa` or `ed25519`. If you do not include the `--key-type` parameter, an `rsa` key is created by default. Note that ED25519 keys are not supported for Windows instances. - -For `--key-format`, specify either `pem` or `ppk`. If you do not include the `--key-format` parameter, a `pem` file is created by default. - -`--query "KeyMaterial"` prints the private key material to the output. - -`--output text > `my-key-pair.pem`` saves the private key material in a file with the specified extension. The extension can be either `.pem` or `.ppk`. The private key can have a name that's different from the public key name, but for ease of use, use the same name. + 1. Use the [create-key-pair](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/create-key-pair.html) command as follows to generate the key pair and to save the private key to a `.pem` file. The `--query` option prints the private key material to the output. The `--output` option saves the private key material in the specified file. The extension should be either `.pem` or `.ppk`, depending on the key format. The private key name can be different from the public key name, but for ease of use, use the same name. @@ -110,11 +100 @@ PowerShell -Use the [New-EC2KeyPair](https://docs.aws.amazon.com/powershell/latest/reference/items/New-EC2KeyPair.html) AWS Tools for Windows PowerShell command as follows to generate the key and save it to a `.pem` or `.ppk` file. - -For `-KeyName`, specify a name for the public key. The name can be up to 255 ASCII characters. - -For `-KeyType`, specify either `rsa` or `ed25519`. If you do not include the `-KeyType` parameter, an `rsa` key is created by default. Note that ED25519 keys are not supported for Windows instances. - -For `-KeyFormat`, specify either `pem` or `ppk`. If you do not include the `-KeyFormat` parameter, a `pem` file is created by default. - -`KeyMaterial` prints the private key material to the output. - -`Out-File -Encoding ascii -FilePath `C:\path\my-key-pair`.pem` saves the private key material in a file with the the specified extension. The extension can be `.pem` or `.ppk`. The private key can have a name that's different from the public key name, but for ease of use, use the same name. +Use the [New-EC2KeyPair](https://docs.aws.amazon.com/powershell/latest/reference/items/New-EC2KeyPair.html) cmdlet as follows to generate the key and save it to a `.pem` or `.ppk` file. The **Out-File** cmdlet saves the private key material in a file with the specified extension. The extension should be either `.pem` or `.ppk`, depending on the key format. The private key name can be different from the public key name, but for ease of use, use the same name. @@ -123 +103,4 @@ For `-KeyFormat`, specify either `pem` or `ppk`. If you do not include the `-Key - PS C:\> (New-EC2KeyPair -KeyName "my-key-pair" -KeyType "rsa" -KeyFormat "pem").KeyMaterial | Out-File -Encoding ascii -FilePath C:\path\my-key-pair.pem + (New-EC2KeyPair ` + -KeyName "my-key-pair" ` + -KeyType "rsa" ` + -KeyFormat "pem").KeyMaterial | Out-File -Encoding ascii -FilePath C:\path\my-key-pair.pem @@ -264,0 +248,5 @@ Use the [import-key-pair](https://awscli.amazonaws.com/v2/documentation/api/late + + aws ec2 import-key-pair \ + --key-name my-key-pair \ + --public-key-material fileb://path/my-key-pair.pub + @@ -268,0 +257,3 @@ Use the [describe-key-pairs](https://awscli.amazonaws.com/v2/documentation/api/l + + aws ec2 describe-key-pairs --key-names my-key-pair + @@ -274 +265,7 @@ PowerShell -Use the [Import-EC2KeyPair](https://docs.aws.amazon.com/powershell/latest/reference/items/Import-EC2KeyPair.html) AWS Tools for Windows PowerShell command. +Use the [Import-EC2KeyPair](https://docs.aws.amazon.com/powershell/latest/reference/items/Import-EC2KeyPair.html) cmdlet. + + + $publickey=[Io.File]::ReadAllText("C:\Users\TestUser\.ssh\id_rsa.pub") + Import-EC2KeyPair ` + -KeyName my-key-pair ` + -PublicKey $publickey @@ -278 +275,4 @@ Use the [Import-EC2KeyPair](https://docs.aws.amazon.com/powershell/latest/refere -Use the [Get-EC2KeyPair](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2KeyPair.html) AWS Tools for Windows PowerShell command. +Use the [Get-EC2KeyPair](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2KeyPair.html) cmdlet. + + + Get-EC2KeyPair -KeyName my-key-pair @@ -288 +288 @@ Key pairs -Tag a key pair +Describe your key pairs