Security group doesn't exist but I know it exists

0

I created a CFN stack for Kubernetes cluster and then deleted it and noticed that the VPC and ENI were left undeleted so wanted to remove the ENI but couldn't because a security group is attached to it. Tried to remove the SG and assign a default VPS SG but it says I don't have permissions to do that. I tried looking up the SG using aws cli but it says that the SG doesn't exist. I can see it right now in my console so why does it say it doesn't exist? I'm stuck. Please help me. How do I remove the ENI, VPC and the SG. Thank you in advance.

  • Search for the ENI to get the subnet and security group(s) it uses with the below command. Ensure you replace <ENI> and <REGION> placeholders with respective values. The output of the below command will be json which you can parse with something like jq. This should align with what you see in the console

    aws ec2 describe-network-interfaces --network-interface-ids <ENI> --filters Name=network-interface-id,Values=ENI --region <REGION> --output json --query 'NetworkInterfaces[0].{Subnet:SubnetId,SecurityGroups:Groups[*].GroupId}')

demandé il y a 2 ans3575 vues
2 réponses
2

Are you in the same region using CLI?

profile picture
MG
répondu il y a 2 ans
  • AWS CLI does not have the option to specify the region

    aws ec2 describe-security-groups --filters Name=vpc-id,Values=... --group-ids ...
    

    An error occurred (InvalidGroup.NotFound) when calling the DescribeSecurityGroups operation: The security group '...' does not exist But I am on the security group page in the console now as we speak so it does exist.

2

Try adding in --region at the end of your CLI command to whatever region you see the Security Group in.

For example:

aws ec2 describe-security-groups ... --group-ids --region us-east-1

You can also run an aws configure get region to get the region of what region your CLI is setup for.

That would be my first look - ensure where you are looking in console matches the region in your CLI.

jsonc
répondu il y a 2 ans
  • You are a genius! Bullseye! That solved my problem. Thank you very much!

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions