-
Notifications
You must be signed in to change notification settings - Fork 4k
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
[elasticsearch] CDK seems not to handle multi-az domains correctly #11026
Comments
Hi @Jon-AtAWS Are you initializing the stack in a specific environment or in an agnostic way? The documentation for the
It's done to make sure that an environment agnostic vpc can actually be deployed to any environment. stack = CdkVpcStack(..., env=core.Environment(account='123456789', region='us-west-2')) As an alternative, you can specify subnet configurations when creating the VPC, in which case you don't have to specify the environment on the stack. But you do have to configure
const vpc = new ec2.Vpc(stack, 'Vpc', {
maxAzs: 99,
natGateways: 1,
subnetConfiguration: [
{
subnetType: ec2.SubnetType.PRIVATE,
name: 'Private1',
},
{
subnetType: ec2.SubnetType.PRIVATE,
name: 'Private2',
},
{
subnetType: ec2.SubnetType.PRIVATE,
name: 'Private3',
},
],
}); |
@iliapolo Not sure about OP, but I face this issue w/ region/account set to Aws.region/Aws.accountId respectively |
@ambasta |
@iliapolo Aight, short of hardcoding these variables, how do you ensure that the pipeline deploys an application to the account/region it is in? |
@ambasta You don't need to hardcode in order to achieve that. You can just not define any environment on the stack and the cdk will use the environment defined in the aws credentials and deploy all stacks to that account and region. You use The only reason to hardcode environment in stacks is if your stack is not environment agnostic, for example, if your VPC needs to be spread on 3 AZ's, its not environment agnostic since not all regions have 3 AZ's. |
Aight, that makes sense. Though I'd really argue default of 3 for HA
instead of 2. Maybe add validation for stack failure if we deploy to a zone
w/ fewer than 3 AZs
…On Mon, Nov 23, 2020 at 11:56 AM Eli Polonsky ***@***.***> wrote:
@ambasta <https://github.com/ambasta> You don't need to hardcode in order
to achieve that. You can just not define any environment on the stack and
the cdk will use the environment defined in the aws credentials and deploy
all stacks to that account and region.
You use Aws.region or Stack.of(this).region to get a reference to the
region if you need it in one of your constructs.
The only reason to hardcode environment in stacks is if your stack is not
environment agnostic, for example, if your VPC needs to be spread on 3
AZ's, its not environment agnostic since not all regions have 3 AZ's.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#11026 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAANGQNTPTRGIEEWUHRPP73SRJEXXANCNFSM4S2MFCUQ>
.
--
⍰⍰⍰
|
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
I'm OK to close this issue. Though, I would argue that CDK can find out how many zones there are in a region and can default to min(3, number of zones in the region) |
|
Context: #10965
Short version: setting 3 AZs for an Amazon ES multi-AZ domain doesn't work with the default aws_vpc, which seems to deploy in 2 zones and I can't find a way to push to 3 zones.
Amazon ES domains can deploy into 1, 2, or 3 AZs, controlled by customer config. Obviously, the VPC must have that many AZs/subnets to support this configuration. See the referenced issue for my struggle with subnets and sending the correct data type. As part of that process, I expanded to 3 AZs. CDK diff did not report a problem, but cdk deploy failed when the subnet count was only 2.
Yields this errror:
So, I also added
But get the same error.
Printing vpc.private_subnets, shows I have 2 (why not 3? I'm deploying in us-west-2). So I changed my node count and zone count to 2 and that worked.
As far as I can tell, there's no way to span 3 zones with a VPC, which mismatches the Amazon Elasticsearch Service best practice, 3-zone deployment. Or is there a less-obvious way to have the vpc in 3 zones?
Reproduction Steps
What did you expect to happen?
The domain should deploy in 3 AZs, according to the config. Alternately, add a min_azs parameter to the vpc() construction.
What actually happened?
cdk deploy failed with insufficient subnets.
Environment
(.env) handler@laptop:
/code/cdk-vpc $ aws --version/code/cdk-vpc $ cdk --versionaws-cli/1.18.114 Python/3.8.3 Darwin/18.7.0 botocore/1.13.50
(.env) handler@laptop:
1.68.0 (build a6a3f46)
(.env) handler@laptop:~/code/cdk-vpc $ node -v
v12.19.0
MacOS Mojave 10.14.6
(.env) handler@laptop:~/code/cdk-vpc $ python --version
Python 3.8.3
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: