The example uses the PublicKeyMaterial parameter, which causes the obsolete warning to be displayed.
C:\> Import-Ec2KeyPair -KeyName KeyName -PublicKeyMaterial $pkbase64
WARNING: Parameter 'PublicKeyMaterial' is obsolete. This parameter is obsolete and will be removed in a future version. Use 'PublicKey' instead.
The example for Import-Ec2KeyPair is out of date. If used, it will raise a warning.
Expected Behavior
This is the expected example text:
Current Behavior
The example uses the PublicKeyMaterial parameter, which causes the obsolete warning to be displayed.
Possible Solution
The example, I believe in https://github.com/aws/aws-tools-for-powershell/blob/7d148285dbd8e0e465f4b5ceccc4053b82b763e2/generator/AWSPSGeneratorLib/HelpMaterials/Examples/EC2/Import-EC2KeyPair.xml should be updated to use the PublicKey parameter which will avoid the Warning message.
If you are able to confirm I'll raise a short PR to fix the issue.
Your Environment