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!

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则

相关内容