Make a VPC default when it is the only one present

0

I have only one VPC in a region that is not set as the default. I don't remember ever deleting a VPC from that region that could have been the default. It is possible that this region was migrated a while back from a classic to a VPC region and no default was set then. Is there a way to get this to be the default? Looking at the documentation it appears that the answer to that is no.

The background to this is that I am attempting to call the CLI command Grant-EC2SecurityGroupIngress for a security group in that VPC but I am getting the error:

Grant-EC2SecurityGroupIngress : No default VPC for this user

I am not sure how to fix that. This is definitely connected to the fact that the existing VPC is not default (and there is not a default one) because when I try it on a different region that has a default VPC it works fine. As far as I can tell there is no way of specifying the VPC in the Grant-EC2SecurityGroupIngress command

zeiddev
gefragt vor einem Jahr296 Aufrufe
1 Antwort
1
Akzeptierte Antwort

Is there a way to get this to be the default? Looking at the documentation it appears that the answer to that is no

Hi. Unfortunately, you can’t.

Can I make an existing VPC the default VPC or restore a deleted default VPC in Amazon VPC? You can't select an existing non-default VPC as your new default VPC. You also can't restore a previous default VPC that you deleted.

https://repost.aws/knowledge-center/deleted-default-vpc

probably, you must specify security group id to overcome the issue.

For security groups in a nondefault VPC, you must specify the security group ID

https://docs.aws.amazon.com/powershell/latest/reference/items/Grant-EC2SecurityGroupIngress.html

profile picture
EXPERTE
beantwortet vor einem Jahr
profile picture
EXPERTE
überprüft vor einem Monat
  • So I understand that I am not able to make a VPC the default but how do I overcome the error that I am getting in that case?

  • Sorry. I‘ve updated my answer.

  • Thank you. That did seem to fix it. Before I was using the groupName parameter to specify the security group. When I switched to groupId it worked. Bit of a misleading error message!

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen