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
已提問 1 年前檢視次數 296 次
1 個回答
1
已接受的答案

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
專家
已回答 1 年前
profile picture
專家
已審閱 1 個月前
  • 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!

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南