Skip to content
GitHubXDiscordRSS

VpcEndpoint

Learn how to create, update, and manage AWS OpenSearchServerless VpcEndpoints using Alchemy Cloud Control.

The VpcEndpoint resource lets you manage AWS OpenSearchServerless VpcEndpoints for accessing OpenSearch Serverless from within your Amazon VPC.

Create a basic VPC endpoint with required properties and one optional property.

import AWS from "alchemy/aws/control";
const vpcEndpoint = await AWS.OpenSearchServerless.VpcEndpoint("myVpcEndpoint", {
VpcId: "vpc-0abcd1234efgh5678",
SubnetIds: [
"subnet-0abcd1234efgh5678",
"subnet-1abcd1234efgh5678"
],
SecurityGroupIds: [
"sg-0abcd1234efgh5678"
],
Name: "MyOpenSearchVpcEndpoint"
});

Configure a VPC endpoint with multiple security groups for enhanced network security.

const advancedVpcEndpoint = await AWS.OpenSearchServerless.VpcEndpoint("advancedVpcEndpoint", {
VpcId: "vpc-0abcd1234efgh5678",
SubnetIds: [
"subnet-0abcd1234efgh5678",
"subnet-1abcd1234efgh5678"
],
SecurityGroupIds: [
"sg-0abcd1234efgh5678",
"sg-1abcd1234efgh5678"
],
Name: "AdvancedOpenSearchVpcEndpoint"
});

If you want to adopt an existing VPC endpoint instead of failing, use the adopt option.

const adoptedVpcEndpoint = await AWS.OpenSearchServerless.VpcEndpoint("adoptedVpcEndpoint", {
VpcId: "vpc-0abcd1234efgh5678",
SubnetIds: [
"subnet-0abcd1234efgh5678",
"subnet-1abcd1234efgh5678"
],
Name: "AdoptedOpenSearchVpcEndpoint",
adopt: true
});