Comments (3)
After some noodling, I realized that there is a reasonable workaround: tag the security group with it's name! That is,
ec2.describe_security_groups(
filters: [
{name: 'vpc-id', values: [vpc_id]},
{name: 'tag:name', values: [group_name]}
]
)
Works if you #create_tags(resources: [group_id], tags: [{ key: name, value: group_name}])
first.
from aws-cli.
The error message you provided indicates that there is an issue with using both the group_names and filters options together when calling the describe_security_groups method in the AWS SDK for Ruby.
from aws-cli.
Describe the issue
group_names: option is incompatible with filters: { name: 'vpc-id', } option.
This looks pretty much like a bug, but I expect it is a lot easier to get a documentation fix than a change to the API.
Demonstration from the ruby sdk:
vpc_id = LambdaFunction::WorkerLambda::VPC_ID.to_s group_name = ec2.describe_security_groups( filters: [{name: 'vpc-id', values: [vpc_id] }]).security_groups[4].group_name ec2.describe_security_groups( filters: [{name: 'vpc-id', values: [vpc_id]}], group_names: [group_name] )/usr/local/bundle/gems/aws-sdk-core-3.190.2/lib/seahorse/client/plugins/raise_response_errors.rb:17:in `call': The security group 'security-group' does not exist in default VPC 'vpc-12345678' (Aws::EC2::Errors::InvalidGroupNotFound)
So the options check does not fail. This looks like a bug in the client, but since we're getting an exception anyway...
I also note that the API documentation indicates that group_ids is a required field if you are not in the default vpc. If this were true, it would be a severe bug. Thankfully, the API does not require this, at least for the case I observe.
Links
https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-security-groups.html https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/EC2/Client.html#describe_security_groups-instance_method
This is my Answer for this documentation i tried this solution using some other Ai tools to leverage my work :
It seems like you're encountering an issue with the AWS SDK for Ruby when using the describe_security_groups method. The error message indicates an incompatibility between the group_names and filters options.
The issue appears to arise when you provide both group_names and filters options in the describe_security_groups call. The error message suggests that the provided security group name (group_name) does not exist in the default VPC.
It's important to note that the AWS API documentation indicates that group_ids is a required field if you are not in the default VPC. However, you've observed that this is not the case in your scenario.
This discrepancy between the documented behavior and the actual behavior you're experiencing could indeed indicate a bug in the AWS SDK for Ruby. It might be worth checking the AWS SDK for Ruby's issue tracker or forums to see if others have reported similar issues. Additionally, reaching out to AWS support could provide further insights or assistance in resolving this issue.
In the meantime, you might consider adjusting your code to either use group_ids instead of group_names or to remove the group_names option altogether if it's not necessary for your use case. This might help to work around the issue until a fix is available.
from aws-cli.
Related Issues (20)
- AWS CLI fails to find a newly created db parameter group HOT 3
- ImportError: cannot import name 'is_s3express_bucket' from 'botocore.utils' when lambda update-function-code HOT 4
- dynamodb update-table missing delete-protection-enabled option
- KMS Decrypt with valid key and cipher-text returns error HOT 2
- Cross platform deploy on aws cloudformation package breaks path seperators
- s3api create-bucket does not work for express one zone directory buckets HOT 2
- (AccessDenied) when calling the ListBuckets operation: Access Denied HOT 1
- aws sso login failed on WSL2 HOT 4
- Neither Cryptography 38.0.4 or Cryptography 40.0.1 works HOT 1
- S3Api get-bucket-location returns "EU" for buckets created in eu-west-1 (Ireland) HOT 2
- Have a command to generate a Redis Auth token just like RDS
- Add creds to .netrc for codeartifact pip login. HOT 3
- [AWS][EC2] create-volume tagging request is made in a second time causing rejection from tagging policies
- list-state-machines does not return all records HOT 2
- aws lambda invoke retries while lambda execution has not failed HOT 1
- Warnings when using Python 3.12 HOT 3
- Unable to generate long-living pre-signed URL HOT 7
- role parameter in eks update-kubeconfig is not being used for aws cli connection HOT 4
- `aws codeartifact login --tool npm` fails with "This command does not support workspaces." HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-cli.