I've been attempting to integrate a non-default VPC into my CDK application, but I'm encountering difficulties with the vpc.fromLookup function. Despite providing filters and setting the environment account and region in the stack, I keep receiving an error stating "Could not find any VPCs matching". I've double checked the VPC ID and Name, both of which are correct. Any assistance would be greatly appreciated as I am still learning AWS and CDK.
I've also attempted using tagName or VPCId separately, but the same error persists.
[Error at /MyStack] Could not find any VPCs matching {"account":"00000000","region":"ca-central-1","filter":{"tag:aws-cdk:subnet-type":"private","vpc-id":"vpc-00000000","tag:Name":"vpc","isDefault":"false"},"returnAsymmetricSubnets":true} Found errors
const vpc = ec2.Vpc.fromLookup(this, "VPC", { vpcName: vpcName, isDefault: false,
vpcId: vpcId, tags: { "aws-cdk:subnet-type": "private" },
});
env: {
account: process.env.CDK_DEPLOY_ACCOUNT || process.env.CDK_DEFAULT_ACCOUNT,
region: process.env.CDK_DEPLOY_REGION || process.env.CDK_DEFAULT_REGION,
},
Thank you for your assistance!