Package: pinecone-db-construct
Pinecone DB Construct for AWS CDKThe Pinecone DB Construct for AWS CDK is a JSII-constructed library that simplifies the creation and management of Pinecone indexes in your AWS infrastructure. It allows you to define, configure, and orchestrate your vector database resources alongside your AWS resources within your CDK application.FeaturesDefine Pinecone index configurations in code using familiar AWS CDK constructs.Automate the setup and configuration of Pinecone resources with AWS Lambda and AWS Secrets Manager.Seamlessly integrate Pinecone DB into your cloud-native applications.Supports ARM serverless for deploymentsInstallationInstall this construct library using npm or pip, depending on your development language:For TypeScript/JavaScript users:npminstallpinecone-db-constructFor Python users:pipinstallpinecone-db-constructUsageTypeScriptBelow is an example demonstrating how to use the Pinecone DB Construct in a TypeScript CDK application:import{App,RemovalPolicy,Stack,StackProps}from'aws-cdk-lib';import{Construct}from'constructs';import{PineconeIndex,PineConeEnvironment}from'../index';classMyStackextendsStack{constructor(scope:Construct,id:string,props?:StackProps){super(scope,id,props);newPineconeIndex(this,'PineconeIndex',{indexSettings:[{apiKeySecretName:'pinecone-test',//storeasastringinsecretsmanager,NOTakey/valuesecretdimension:128,removalPolicy:RemovalPolicy.RETAIN_ON_UPDATE_OR_DELETE,//PodIndex(seepythonexampleforserverless)podSpec:{environment:PineConeEnvironment.GCP_STARTER,},}],deploymentSettings:{maxNumAttempts:2,},},);}}constAPP=newApp();newMyStack(APP,'MyStack');APP.synth();PythonFor CDK applications written in Python, you can use the construct as shown:fromconstructsimportConstructfromaws_cdkimport(App,RemovalPolicy,Stack,)frompinecone_db_constructimport(PineconeIndex,CloudProvider,Region,PineconeIndexSettings,ServerlessSpec,DeploymentSettings,)sclassMyStack(Stack):def__init__(self,scope:Construct,id:str,**kwargs)->None:super().__init__(scope,id,**kwargs)PineconeIndex(self,'PineconeIndex',index_settings=[PineconeIndexSettings(api_key_secret_name='pinecone-test',# store as a string in secrets manager, NOT a key/value secretdimension=128,removal_policy=RemovalPolicy.RETAIN_ON_UPDATE_OR_DELETE,# Serverless Index (see typescript example for Pod)pod_spec=ServerlessSpec(cloud_provider=CloudProvider.AWS,region=Region.US_WEST_2,),),],deployment_settings=DeploymentSettings(max_num_attempts=2,),)APP=App()MyStack(APP,'MyStack')APP.synth()Common IssuesIf running the ARM deployment architecture (configurable through thedeploymentSettingsprop) and deploying ON (not to) an x86_64 machine, you may run into the dreadedexec /bin/sh: exec format error, if this happens you have two options:Switch to x86 architecture (Lame 😒):new PineconeIndex(
this,
'PineconeIndex',
{
  deploymentSettings: {
    deploymentArchitecture: lambda.Architecture.X86_64,
  },
  .
  .
  .
})Allow docker to emulate ARM (Better 💪):docker run --rm --privileged multiarch/qemu-user-static --reset -p yesNote:first time bundling in emulation mode will be slower when running in emulation mode, so keep that in mind (adds about 40 sec for first time deployment).Most most CICD environments will do this for you (github actions) with do this emulation out of the box for you.ContributingI'd love if you wanted to contribute, provide feedback, and/or report bugs. Before you contribute, please read thecontributing guidelines.