A CDK construct for Pinecone Indexes
Project description
Pinecone DB Construct for AWS CDK
The 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.
Features
- Define 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 deployments
Installation
Install this construct library using npm or pip, depending on your development language:
For TypeScript/JavaScript users:
npm install pinecone-db-construct
For Python users:
pip install pinecone-db-construct
Usage
TypeScript
Below 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';
class MyStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
new PineconeIndex(
this,
'PineconeIndex',
{
indexSettings: [{
apiKeySecretName: 'pinecone-test',
environment: PineConeEnvironment.GCP_STARTER,
dimension: 128,
removalPolicy: RemovalPolicy.SNAPSHOT,
}],
customResourceSettings: {
numAttemptsToRetryOperation: 2,
},
},
);
}
}
const APP = new App();
new MyStack(APP, 'MyStack');
APP.synth();
Python
For CDK applications written in Python, you can use the construct as shown:
from aws_cdk import (
App,
RemovalPolicy,
Stack,
StackProps
)
from constructs import Construct
from pinecone_db_construct import PineconeIndex, PineConeEnvironment # Assuming these exist in the ../index file relative to this file
class MyStack(Stack):
def __init__(self, scope: Construct, id: str, props: StackProps = None):
super().__init__(scope, id, props)
PineconeIndex(
self,
'PineconeIndex',
index_settings=[{
'api_key_secret_name': 'pinecone-test',
'environment': PineConeEnvironment.GCP_STARTER,
'dimension': 128,
'removal_policy': RemovalPolicy.SNAPSHOT,
}],
custom_resource_settings={
'num_attempts_to_retry_operation': 2,
}
)
APP = App()
MyStack(APP, 'MyStack')
APP.synth()
Common Issues
If running the default ARM deployment architecture and deploying on an x86_64 machine, you may run into the dreaded exec /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 yes
Note: first time bundling 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.
Contributing
We welcome contributions, feedback, and bug reports. Before you contribute, please read our contributing guidelines.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pinecone-db-construct-0.0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3281adff0a21c70db36173ab32cbab17b627c7541d08b8a7e80e4e67ca6441bd |
|
MD5 | 211afaee77449fa439df2458b341bc5b |
|
BLAKE2b-256 | 09dea2a2a95729322b498d5611b84d7b31edb56b64674da6ef042c815f567655 |
Hashes for pinecone_db_construct-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 288c4ce51100f5d7196abca947e992bf189bdd2bfc344fcdc22e948045ed15c5 |
|
MD5 | 392ec2da4f2268e9213076e90eb58f9c |
|
BLAKE2b-256 | fc0cdf65e8e434ae601031d578e6ff5a02092a025738391ab0ad07f0d76a6019 |