https://pulumi.com logo
#aws
Title
n

narrow-river-17495

08/02/2023, 9:22 PM
Is there a good pattern for deleting all of the default VPCs in an AWS account using Pulumi?
g

gifted-gigabyte-53859

08/03/2023, 2:02 AM
An AWS account can only have 1 default VPC surely? You can reference the default VPC using the crosswalk API (probably other methods, this is the one I know about) https://www.pulumi.com/docs/clouds/aws/guides/vpc/#getting-the-default-vpc
Ok, I remembered there is a VPC per region. So what you'd do is create a list of all regions you care about, perhaps using something like https://www.pulumi.com/registry/packages/aws/api-docs/getregions/ and cycle through them, deleting the VPC each time.
2 Views