Browse through the questions and answers listed below or filter and sort to narrow down your results.
Why won't the CDK let me divide my network?
## Problem
I am trying to use CDK for the first time and trying to divide a `10.0.0.0/24` VPC into 8 /27 subnets with 4 public and 4 private subnets spanning no more than 4 Availability Zones. When I run `cdk deploy` I am receiving the following error.
```
Error: 1 of /27 exceeds remaining space of 10.0.0.0/24
```
Multiple websites have displayed that I can split the network this way.
* https://www.davidc.net/sites/default/subnets/subnets.html
* http://jodies.de/ipcalc?host=10.0.0.0&mask1=24&mask2=27
I know that AWS reserves 5 IP addresses from each subnet, but that should still leave 25 hosts per subnet, which is plenty for my exercise.
----
## Code
```
new ec2.Vpc(this, 'SimpleVpc', {
cidr: '10.0.0.0/24',
maxAzs: 4,
natGateways: 1,
subnetConfiguration:
SimpleVpcStack.createSubnets(SubnetType.PUBLIC).concat(
SimpleVpcStack.createSubnets(SubnetType.PRIVATE_WITH_NAT))
});
private static createSubnets(type: SubnetType): ec2.SubnetConfiguration[] {
const label = SubnetType.PUBLIC === type ? 'pub' : 'pvt';
const subnets: ec2.SubnetConfiguration[] = [];
for(let i = 1; i < 5; i++){
subnets.push({
cidrMask: 27,
name: `${label}-${i}`,
subnetType: type
});
}
return subnets;
}
```
----
## Logs
```
subnets [
{ cidrMask: 27, name: 'pub-1', subnetType: 'Public' },
{ cidrMask: 27, name: 'pub-2', subnetType: 'Public' },
{ cidrMask: 27, name: 'pub-3', subnetType: 'Public' },
{ cidrMask: 27, name: 'pub-4', subnetType: 'Public' },
{ cidrMask: 27, name: 'pvt-1', subnetType: 'Private' },
{ cidrMask: 27, name: 'pvt-2', subnetType: 'Private' },
{ cidrMask: 27, name: 'pvt-3', subnetType: 'Private' },
{ cidrMask: 27, name: 'pvt-4', subnetType: 'Private' }
]
```
Accepted AnswerDeveloper Tools
1
answers
0
votes
21
views
asked 5 months ago
Using the encryption sdk within lambda
Hi,
I am trying to use the aws encryption sdk within a lambda, however i am getting multiple errors when attempting to do so.
Is there a guide which shows you how to import the requisite libraries into a lambda function ?
Accepted AnswerDeveloper Tools
2
answers
0
votes
12
views
asked 2 years ago