Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PRO] public subnets is not created #69

Closed
gooftroop opened this issue May 24, 2022 · 5 comments
Closed

[PRO] public subnets is not created #69

gooftroop opened this issue May 24, 2022 · 5 comments

Comments

@gooftroop
Copy link

gooftroop commented May 24, 2022

Using the following code, I expect to see 3 subnets create - a private with NAT, isolated, and a public.

const vpc = new ec2.Vpc(this, `${id}CoreVpc`, {
    maxAzs: 1,
    cidr: scope.node.tryGetContext('cidr') || process.env.VPC_CIDR || '10.0.0.0/16',
    natGateways: 1,
    vpcName: `${name}-vpc`,
    subnetConfiguration: [{
        name: `${stage}-private-subnet`,
        subnetType: ec2.SubnetType.PRIVATE_WITH_NAT,
        cidrMask: 24,
    }, {
        name: `${stage}-public-subnet`,
        subnetType: ec2.SubnetType.PUBLIC,
        cidrMask: 24,
        mapPublicIpOnLaunch: true,
    }, {
        name: `${stage}-isolated-subnet`,
        subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
        cidrMask: 28,
    }],
});

Output:

VPC

{
            "CidrBlock": "10.0.0.0/16",
            "DhcpOptionsId": "dopt-7a8b9c2d",
            "State": "available",
            "VpcId": "vpc-912e4792",
            "OwnerId": "000000000000",
            "InstanceTenancy": "default",
            "Ipv6CidrBlockAssociationSet": [],
            "CidrBlockAssociationSet": [
                {
                    "AssociationId": "vpc-cidr-assoc-b57c5b2e",
                    "CidrBlock": "10.0.0.0/16",
                    "CidrBlockState": {
                        "State": "associated"
                    }
                }
            ],
            "IsDefault": false,
            "Tags": []
        }

Subnets

{
            "AvailabilityZone": "us-east-1a",
            "AvailabilityZoneId": "use1-az6",
            "AvailableIpAddressCount": 251,
            "CidrBlock": "10.0.0.0/24",
            "DefaultForAz": false,
            "MapPublicIpOnLaunch": false,
            "State": "available",
            "SubnetId": "subnet-043cbbc5",
            "VpcId": "vpc-912e4792",
            "OwnerId": "000000000000",
            "AssignIpv6AddressOnCreation": false,
            "Ipv6CidrBlockAssociationSet": [],
            "SubnetArn": "arn:aws:ec2:us-east-1:000000000000:subnet/subnet-043cbbc5"
        },
        {
            "AvailabilityZone": "us-east-1a",
            "AvailabilityZoneId": "use1-az6",
            "AvailableIpAddressCount": 250,
            "CidrBlock": "10.0.1.0/24",
            "DefaultForAz": false,
            "MapPublicIpOnLaunch": false,
            "State": "available",
            "SubnetId": "subnet-bb515ce0",
            "VpcId": "vpc-912e4792",
            "OwnerId": "000000000000",
            "AssignIpv6AddressOnCreation": false,
            "Ipv6CidrBlockAssociationSet": [],
            "SubnetArn": "arn:aws:ec2:us-east-1:000000000000:subnet/subnet-bb515ce0"
        },
        {
            "AvailabilityZone": "us-east-1a",
            "AvailabilityZoneId": "use1-az6",
            "AvailableIpAddressCount": 11,
            "CidrBlock": "10.0.2.0/28",
            "DefaultForAz": false,
            "MapPublicIpOnLaunch": false,
            "State": "available",
            "SubnetId": "subnet-d1c2ad16",
            "VpcId": "vpc-912e4792",
            "OwnerId": "000000000000",
            "AssignIpv6AddressOnCreation": false,
            "Ipv6CidrBlockAssociationSet": [],
            "SubnetArn": "arn:aws:ec2:us-east-1:000000000000:subnet/subnet-d1c2ad16"
        }

I would have expected subnet-bb515ce0 to have MapPublicIpOnLaunch set to true. I've tried various configurations to debug this (i.e. using the default configuration for vpcs by omitting the subnetConfiguration, only specifying the public configuration) without any luck.
There is a pre-existing default VPC, but I've verified that no configuration is shared:

{
            "CidrBlock": "172.31.0.0/16",
            "DhcpOptionsId": "dopt-7a8b9c2d",
            "State": "available",
            "VpcId": "vpc-2d9e57fd",
            "OwnerId": "000000000000",
            "InstanceTenancy": "default",
            "Ipv6CidrBlockAssociationSet": [],
            "CidrBlockAssociationSet": [
                {
                    "AssociationId": "vpc-cidr-assoc-7d41565d",
                    "CidrBlock": "172.31.0.0/16",
                    "CidrBlockState": {
                        "State": "associated"
                    }
                }
            ],
            "IsDefault": true,
            "Tags": []
        }

I've attached the output log from my locastack container.

Could this be something up with the cdklocal library or maybe something with localstack (or my configuration)?
localstack_output.txt

@gooftroop
Copy link
Author

Any guidance on this?

@whummer
Copy link
Member

whummer commented Jun 1, 2022

Hi @gooftroop , thanks for reporting. Turns out this was an issue in LocalStack itself (not the cdklocal script per se). We have now pushed a small fix for this - can you please pull the latest Docker image and give it another try? Please let us know if the problem persists.. Thanks!

@gooftroop
Copy link
Author

Hi @whummer just confirmed that most of this appears to be fixed. I am able to use public and private subnets now, but isolated subnets are still missing from the returned VPC resource. Is that related to the original issue?

@dominikschubert dominikschubert removed their assignment Sep 2, 2022
@lakkeger
Copy link
Contributor

Hi! We just wanted to follow up on our last message to see whether your issue has been resolved. Were you able to get it working with the latest version of LocalStack? We would appreciate your feedback!

@lakkeger
Copy link
Contributor

Closing the issue due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants