aws ssm put-parameter performs an HTTP GET request when the value param is an url
Problem
When you try to put a parameter into ssm-param-store with an url on the value `aws-cli` perform a HTTP GET request to the value. [code block] [code block] [code block] [code block] [code block]
Error Output
error detected: Value '<!doctype html><html itemscope=\"\" itemtype=\"http://schema.org/WebPage\" lang=\"en\"><head><meta content=\"Search the world's information, including webpages, images, videos and mor
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Fix AWS SSM Put-Parameter URL Handling
The AWS CLI's `put-parameter` command interprets certain values as URLs and attempts to perform an HTTP GET request to retrieve the value instead of treating it as a plain string. This behavior leads to unexpected results and errors when the URL is not accessible or returns an HTML response.
Awaiting Verification
Be the first to verify this fix
- 1
Escape the URL
Use URL encoding to escape special characters in the URL value. This prevents the AWS CLI from interpreting it as a URL to fetch.
bashaws ssm put-parameter --name 'myParameter' --value 'https%3A%2F%2Fexample.com%2Fmyvalue' --type 'String' - 2
Use a Different Parameter Type
If the URL is not meant to be accessed, consider storing it as a SecureString or StringList to avoid misinterpretation.
bashaws ssm put-parameter --name 'mySecureParameter' --value 'https://example.com/myvalue' --type 'SecureString' - 3
Check for URL Accessibility
Before using a URL as a parameter value, ensure that it is accessible and returns the expected content. This can help avoid errors during retrieval.
bashcurl -I 'https://example.com/myvalue' - 4
Update AWS CLI
Ensure that you are using the latest version of the AWS CLI, as updates may include fixes or improvements related to parameter handling.
bashpip install --upgrade awscli
Validation
Run the `aws ssm get-parameter --name 'myParameter'` command to verify that the parameter value is stored correctly and does not trigger an HTTP GET request. Confirm that the output matches the expected value.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep