-
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
(opensearchservice): must configure zone awareness settings even when i am not enabling zone awareness #29346
Comments
I was able to reproduce this and confirmed the template contains the following:
This feels like a CFN bug, as the error is from CFN not the CDK. cc/ @pahud |
I see this from the doc:
And I got this error when I deploy across 3 subnets/AZs
Looks like when vpcSubnets: [
{ subnetType: SubnetType.PRIVATE_WITH_EGRESS },
], My workaround is: export class DummyStack extends Stack {
constructor(scope: Construct, id: string, props: StackProps) {
super(scope, id, props);
const vpc = getDefaultVpc(this);
const opensearchDomain = new opensearch.Domain(this, "Domain", {
vpc,
vpcSubnets: [
{ subnetType: SubnetType.PRIVATE_WITH_EGRESS },
],
version: opensearch.EngineVersion.OPENSEARCH_2_5,
tlsSecurityPolicy: opensearch.TLSSecurityPolicy.TLS_1_2,
enableVersionUpgrade: true,
removalPolicy: RemovalPolicy.DESTROY,
zoneAwareness: {
enabled: false,
},
capacity: {
dataNodeInstanceType: "t3.small.search",
dataNodes: 1,
},
});
const cfndomain = opensearchDomain.node.tryFindChild('Resource') as opensearch.CfnDomain
const selectedSubnetIds = vpc.selectSubnets({ subnetType: SubnetType.PRIVATE_WITH_EGRESS }).subnetIds
cfndomain.addPropertyOverride('VPCOptions.SubnetIds', [ selectedSubnetIds[0] ] )
}
} I will create an internal ticket to clarify if only 1 subnet is allowed when zoneAawreness is disabled. Meanwhile, can you share your use case that you need multiple AZs with zoneAawreness disabled? |
My use case is that I was actually trying to create a domain with no multiple AZs, only a single AZ When I try to do that, I receive the above error
At no point did I enable zone awareness explicitly, in fact I've explicitly turned it off. Could be because I'm supplying multiple subnets tho, as mentioned above (supplying the private ones) But I also tried doing
And still got the same error |
@orshemtov check out my workaround in my last comment |
internal tracking: V1282499345 |
@pahud So I've changed my CDK construct to what you've suggested: import * as cdk from "aws-cdk-lib";
import * as ec2 from "aws-cdk-lib/aws-ec2";
import * as opensearch from "aws-cdk-lib/aws-opensearchservice";
import { Construct } from "constructs";
export interface OpenSearchProps {
vpc: ec2.IVpc;
subnets: ec2.ISubnet[];
}
export class OpenSearch extends Construct {
constructor(scope: Construct, id: string, props: OpenSearchProps) {
super(scope, id);
const { vpc, subnets } = props;
const securityGroup = new ec2.SecurityGroup(this, "SecurityGroup", {
vpc,
allowAllOutbound: true,
});
securityGroup.addIngressRule(
ec2.Peer.ipv4(vpc.vpcCidrBlock),
ec2.Port.tcp(9200)
);
securityGroup.addIngressRule(
ec2.Peer.ipv4(vpc.vpcCidrBlock),
ec2.Port.tcp(9300)
);
const opensearchDomain = new opensearch.Domain(this, "Domain", {
vpc,
vpcSubnets: [
{
subnets,
},
],
securityGroups: [securityGroup],
version: opensearch.EngineVersion.OPENSEARCH_2_5,
tlsSecurityPolicy: opensearch.TLSSecurityPolicy.TLS_1_2,
enableVersionUpgrade: true,
removalPolicy: cdk.RemovalPolicy.DESTROY,
capacity: {
dataNodeInstanceType: "t3.small.search",
dataNodes: 1,
},
});
const cfnDomain = opensearchDomain.node
.defaultChild as opensearch.CfnDomain;
const selectedSubnetIds = vpc.selectSubnets({
subnets,
}).subnetIds;
cfnDomain.addPropertyOverride("VPCOptions.SubnetIds", [
selectedSubnetIds[0],
]);
new cdk.CfnOutput(this, "Endpoint", {
value: opensearchDomain.domainEndpoint,
});
}
} And I'm still getting the same error after doing
|
I didn't see you turn on zone awareness from your code snippet above and it should be Can you check your |
im getting this synth OpenSearchDomain099259C2:
Type: AWS::OpenSearchService::Domain
Properties:
ClusterConfig:
DedicatedMasterEnabled: false
InstanceCount: 1
InstanceType: t3.small.search
MultiAZWithStandbyEnabled: true
ZoneAwarenessEnabled: false
DomainEndpointOptions:
EnforceHTTPS: false
TLSSecurityPolicy: Policy-Min-TLS-1-2-2019-07
EBSOptions:
EBSEnabled: true
VolumeSize: 10
VolumeType: gp2
EncryptionAtRestOptions:
Enabled: false
EngineVersion: OpenSearch_2.5
LogPublishingOptions: {}
NodeToNodeEncryptionOptions:
Enabled: false
Tags:
- Key: app
Value: vita-llms
- Key: env
Value: dev
VPCOptions:
SecurityGroupIds:
- Fn::GetAtt:
- OpenSearchSecurityGroup70E5053B
- GroupId
SubnetIds:
- subnet-01da729e6394035cc
UpdatePolicy:
EnableVersionUpgrade: true
UpdateReplacePolicy: Delete
DeletionPolicy: Delete
Metadata:
aws:cdk:path: VitaLlmsStack/OpenSearch/Domain/Resource original cdk code const opensearchDomain = new opensearch.Domain(this, "Domain", {
vpc,
vpcSubnets: [
{
subnets,
},
],
securityGroups: [securityGroup],
version: opensearch.EngineVersion.OPENSEARCH_2_5,
tlsSecurityPolicy: opensearch.TLSSecurityPolicy.TLS_1_2,
enableVersionUpgrade: true,
removalPolicy: cdk.RemovalPolicy.DESTROY,
capacity: {
dataNodeInstanceType: "t3.small.search",
dataNodes: 1,
},
});
const cfnDomain = opensearchDomain.node
.defaultChild as opensearch.CfnDomain;
const selectedSubnetIds = vpc.selectSubnets({
subnets,
}).subnetIds;
cfnDomain.addPropertyOverride("VPCOptions.SubnetIds", [
selectedSubnetIds[0],
]); for some reason this comes out 'true', im not sure if thats intended:
|
it turns out this flag can be disabled by setting capacity: {
dataNodeInstanceType: "t3.small.search",
dataNodes: 1,
multiAzWithStandbyEnabled: false,
}, tho, i think this is a bug because the doc for this flag states the default should be false: /**
* Indicates whether Multi-AZ with Standby deployment option is enabled.
* For more information, see [Multi-AZ with Standby]
* (https://docs.aws.amazon.com/opensearch-service/latest/developerguide/managedomains-multiaz.html#managedomains-za-standby)
*
* @default - no multi-az with standby
*/
readonly multiAzWithStandbyEnabled?: boolean; now my deployment still hasnt failed for a few minutes |
final code that worked: const opensearchDomain = new opensearch.Domain(this, "Domain", {
vpc,
vpcSubnets: [
{
subnets: [subnets[0]],
},
],
securityGroups: [securityGroup],
version: opensearch.EngineVersion.OPENSEARCH_2_5,
tlsSecurityPolicy: opensearch.TLSSecurityPolicy.TLS_1_2,
enableVersionUpgrade: true,
removalPolicy: cdk.RemovalPolicy.DESTROY,
capacity: {
dataNodeInstanceType: "t3.small.search",
dataNodes: 1,
multiAzWithStandbyEnabled: false,
},
}); |
Thank you @orshemtov |
Thanks, I'm facing exactly same issue |
Describe the bug
When creating an opensearch domain using AWS CDK, I am getting the following error:
Invalid request provided: You must configure zone awareness settings if you turn on zone awareness
My CDK code is as follows:
I've also tried with omitting
zoneAwareness
altogetherExpected Behavior
The cluster should be deployed in a single AZ
Current Behavior
There is an error stating that zone awareness must be configured, even tho my zone awareness is set to false
Reproduction Steps
Create a CDK stack
Possible Solution
Downgrading to CDK version
2.85.0
seems to fix the problemAdditional Information/Context
No response
CDK CLI Version
2.117.0 (build 59d9b23)
Framework Version
2.127.0
Node.js Version
v21.6.2
OS
macos
Language
TypeScript
Language Version
5.3.3
Other information
No response
The text was updated successfully, but these errors were encountered: