(InvalidKeyId) when calling the PutParameter operation: Invalid keyId xxxxxxxxxxx (Service: AWSKMS; Status Code: 400; Error Code: NotFoundException; Request ID: xxxxx Proxy: null)
Getting an InvalidKeyID error when trying to add a parameter to AWS Systems Manager Parameter Store — but the key exists
This error is confusing because the key passed into the key-id parameter in this command does exist:
aws ssm put-parameter --name $ami_latest --value $image_id --type SecureString --key-id $key --overwrite
The problem I had in this particular case was that I had two variables with the same name, which became apparent when I printed out the key value.
Normally, this error would indicate there’s a typo in the key name, it’s not set, or it does not exist for some other reason. Also make sure you pass in the full ARN, not just the key name. The best thing you can do to prevent typos is to navigate to the KMS service, click on the key, copy the ARN, and paste it into your code to prevent typos.
If you liked this story please clap and follow:
Medium: Teri Radichel or Email List: Teri Radichel
Twitter: @teriradichel or @2ndSightLab
Requests services via LinkedIn: Teri Radichel or IANS Research
© 2nd Sight Lab 2022
About this blog:
Want to learn more about Cybersecurity and Cloud Security? Check out: Cybersecurity for Executives in the Age of Cloud on Amazon
Need Cloud Security Training? 2nd Sight Lab Cloud Security Training
Cybersecurity & Cloud Security Resources by Teri Radichel: Cybersecurity and Cloud security classes, articles, white papers, presentations, and podcasts