-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The example CLI for aws ec2 modify-security-group-rules is not working #7227
Comments
Experiencing the same issue. |
Hello and thanks for reaching out. It looks like the example should be:
I created the PR linked above to update the example. |
Hey guys, I struggled with this issue for 3 hours and finally hit the right syntax for this command to work. Hidden in an input here by Akshat Sachdeva. The correct syntax will be: aws ec2 modify-security-group-rules --group-id sg-xxx OR aws ec2 modify-security-group-rules --group-id sg-xxx PLEASE NOTICE, the single quote and double quote symbols for both options and understand them. |
Example is not clear or followable. Not sure how I landed on quotation which was accepted, and its ugly, but it worked from terminal:
|
Same here... 😕 |
Thanks to @tjrjaws your example worked for me!
|
Tried to fix this in this PR. Can anyone please have a review? |
[leosilvapaiola] > Your solution worked for me, thanks :) |
One more way: aws ec2 modify-security-group-rules --group-id sg-0000000000 --security-group-rules SecurityGroupRuleId=sgr-000000000000000,SecurityGroupRule="{IpProtocol=tcp,FromPort=80,ToPort=80,CidrIpv4=0.0.0.0/0}" I believe that amazon people simply forgot to put double quotes, I haven't tested it, but it's possible that it works with single quotes too. |
Yes that works too, but the main issue was in my case, when I wanted to add a 'description' to the rule. There it is when you have to be careful with the single quotes or the double quotes. |
Thanks for lots of good examples. |
The quoting in the documented example has since been fixed: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/modify-security-group-rules.html |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Describe the bug
According to document
https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/modify-security-group-rules.html
aws ec2 modify-security-group-rules
--group-id sg-1234567890abcdef0
--security-group-rules SecurityGroupRuleId=sgr-abcdef01234567890,SecurityGroupRule={Description=test,IpProtocol=-1,CidrIpv4=0.0.0.0/0}
Expected Behavior
{
"Return": true
}
Current Behavior
Parameter validation failed:
Invalid type for parameter SecurityGroupRules[0].SecurityGroupRule, value: Description=test, type: <class 'str'>, valid types: <class 'dict'>
Invalid type for parameter SecurityGroupRules[1].SecurityGroupRule, value: IpProtocol=-1, type: <class 'str'>, valid types: <class 'dict'>
Invalid type for parameter SecurityGroupRules[2].SecurityGroupRule, value: CidrIpv4=0.0.0.0/0, type: <class 'str'>, valid types: <class 'dict'>
Reproduction Steps
aws --version
aws-cli/1.22.81 Python/3.7.10 Linux/4.14.290-217.505.amzn2.x86_64 botocore/1.24.26
just copy/past the example in the document in the console.
Possible Solution
aws ec2 modify-security-group-rules
--group-id sg-1234567890abcdef0
--security-group-rules SecurityGroupRuleId=sgr-abcdef01234567890,SecurityGroupRule='{Description=test,IpProtocol=-1,CidrIpv4=0.0.0.0/0}'
Additional Information/Context
No response
CLI version used
1.22.81
Environment details (OS name and version, etc.)
Amazon Linux 2
The text was updated successfully, but these errors were encountered: