Skip to content

Commit

Permalink
vpc endpoint subnets should be in different availability zones
Browse files Browse the repository at this point in the history
  • Loading branch information
orangewise authored and bigadsoleiman committed Jan 9, 2024
1 parent a8c6709 commit a27839b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/rag-engines/opensearch-vector/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,18 @@ export class OpenSearchVector extends Construct {
ec2.Port.tcp(443)
);

// Make sure the subnets are not in the same availability zone.
let seen = new Set<string>();
const cfnVpcEndpoint = new oss.CfnVpcEndpoint(this, "VpcEndpoint", {
name: Utils.getName(props.config, "genaichatbot-vpce"),
subnetIds: props.shared.vpc.privateSubnets.map(
subnetIds: props.shared.vpc.filter(obj => {
if (seen.has(obj.availabilityZone)) {
return false;
} else {
seen.add(obj.availabilityZone);
return true;
}
}).privateSubnets.map(
(subnet) => subnet.subnetId
),
vpcId: props.shared.vpc.vpcId,
Expand Down

1 comment on commit a27839b

@ykavuda-itc
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,

I am trying to launch AI chatbot but am getting errors when running build with the updated code. I was able to create AI chatbot with the old code with no errors yesterday.

======================================================
tempsol:~/environment/aws-genai-llm-chatbot (main) $ npm install && npm run build
npm WARN deprecated @aws-sdk/[email protected]: This package has moved to @smithy/signature-v4
npm WARN deprecated @aws-sdk/[email protected]: This package has moved to @smithy/protocol-http

added 321 packages, and audited 356 packages in 15s

45 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

[email protected] build
tsc

lib/rag-engines/opensearch-vector/index.ts:50:10 - error TS2339: Property 'filter' does not exist on type 'Vpc'.

50 .filter((obj) => {
~~~~~~

lib/rag-engines/opensearch-vector/index.ts:50:18 - error TS7006: Parameter 'obj' implicitly has an 'any' type.

50 .filter((obj) => {
~~~

lib/rag-engines/opensearch-vector/index.ts:58:30 - error TS7006: Parameter 'subnet' implicitly has an 'any' type.

58 .privateSubnets.map((subnet) => subnet.subnetId),
~~~~~~

Found 3 errors in the same file, starting at: lib/rag-engines/opensearch-vector/index.ts:50

Is there any configuration set up changes needed to accomodate the new code changes ?

Thanks,
Raj K

Please sign in to comment.