-
Notifications
You must be signed in to change notification settings - Fork 654
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
RevokeSecurityGroupEgress and AuthorizeSecurityGroupEgress requests not working #2559
Comments
Hi @awatterson22 - thanks for reaching out and sorry to hear about the issue. The errors you're seeing indicate that you might have some params that are invalid for For further investigation, can you please enable request and response logging and share with us here? cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion("us-east-1"), config.WithClientLogMode(aws.LogRequestWithBody|aws.LogResponseWithBody))
if err != nil {
panic(err)
} Best, |
Hi, thank you for your reply. Here is the logging output with information redacted:
|
@aBurmeseDev - any updates on this issue? Thank you! |
HI @awatterson22 - thanks for sharing the logs and apology for the delay. I've attempted to reproduce by calling According to the logs and error, it confirms that you have invalid params for both calls ( output, _ := client.DescribeSecurityGroups(context.TODO(), &ec2.DescribeSecurityGroupsInput{
Filters: []types.Filter{
{
Name: aws.String("group-id"),
Values: []string{"sg-fake-id"},
},
},
})
sg := output.SecurityGroups[0]
revokeInput := &ec2.RevokeSecurityGroupEgressInput{
GroupId: sg.GroupId,
IpPermissions: sg.IpPermissionsEgress,
} Next step is to confirm if you're actually getting your params correctly from |
@aBurmeseDev, so I did take a look at what I am getting back from DescribeSecurityGroups. The GroupId is correct. When looking at it I get only 2 items, but in the AWS Console, there are 3 items. Maybe that could be why? This is what the RevokeSecurityGroupEgress is sending: Action=RevokeSecurityGroupEgress |
I looped through and changed to this:
Revoke and Authorize then worked. Is it possible that we could allow empty lists as part of the validation? |
This breaks down like so:
The latter is the root cause here. We can see from the wire log that the Changing v2's deserialization to match v1's isn't out of the question, but of course that could technically break something else. v2's deserialization is arguably more correct. Ignoring that the difference doesn't matter in go, v2 correctly handles the distinction between "empty list" and "no list" as it comes back on the wire. As a Go SDK user you won't care though, and since this particular protocol is used only in EC2, I'm including it here as an option. Upstreaming this to EC2 is the only other way forward. I don't think their software should care about the difference between the two, at least for these particular operations, but it's impossible to know without asking them directly. |
The change we previously made to serialize empty lists should have only applied to awsQuery services, not ec2Query. Will be resolved by addressing #2627. |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Acknowledgements
go get -u github.com/aws/aws-sdk-go-v2/...
)Describe the bug
When running this file:
Note:
sg-fake-id
is not what is actually used but a real security group id from the AWS Console is usedI get an error saying
Or
Expected Behavior
I expected to be able to revoke all the egress rules from the security group after getting them from the describe command. This logic works for aws-sdk-go, but I am trying to upgrade to aws-sdk-go-v2
Current Behavior
I am getting an error saying
Or
Reproduction Steps
Can be reproduced by running the script above
Possible Solution
No response
Additional Information/Context
No response
AWS Go SDK V2 Module Versions Used
go.mod
file:Compiler and Version used
go version go1.22.1 darwin/arm64
Operating System and version
macOs Sonoma - Version 14.2.1
The text was updated successfully, but these errors were encountered: