Skip to main content

Pinecone DB Icon

Pinecone DB Construct for AWS CDK

CI NPM version PyPI version License

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',  // store as a string in secrets manager, NOT a key/value secret
          dimension: 128,
          removalPolicy: RemovalPolicy.RETAIN_ON_UPDATE_OR_DELETE,
          // Pod Index (see python example for serverless)
          podSpec: {
            environment: PineConeEnvironment.GCP_STARTER,
          },
        }],
        deploymentSettings: {
          maxNumAttempts: 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 constructs import Construct
from aws_cdk import (
    App,
    RemovalPolicy,
    Stack,
)
from pinecone_db_construct import (
    PineconeIndex,
    CloudProvider,
    Region,
    PineconeIndexSettings,
    ServerlessSpec,
    DeploymentSettings,
)s


class MyStack(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 secret
                    dimension=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 Issues

If running the ARM deployment architecture (configurable through the deploymentSettings prop) and deploying ON (not to) an x86_64 machine, you may run into the dreaded exec /bin/sh: exec format error, if this happens you have two options:

  1. Switch to x86 architecture (Lame 😒):
new PineconeIndex(
this,
'PineconeIndex',
{
  deploymentSettings: {
    deploymentArchitecture: lambda.Architecture.X86_64,
  },
  .
  .
  .
})
  1. Allow docker to emulate ARM (Better 💪):
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

Note: 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.

Contributing

I'd love if you wanted to contribute, provide feedback, and/or report bugs. Before you contribute, please read the contributing guidelines.

Metadata

Release files for pinecone-db-construct 0.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pinecone-db-construct 0.0.10
File Size Uploaded
pinecone-db-construct-0.0.10.tar.gz 60.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pinecone-db-construct 0.0.10
File Interpreter ABI Platform
pinecone_db_construct-0.0.10-py3-none-any.whl Python 3 none any Details

Total release size: 118.4 kB

Release files / pinecone-db-construct-0.0.10.tar.gz

Download URL pinecone-db-construct-0.0.10.tar.gz
Size 60.0 kB
Tags Source
SHA-256 checksum
How to use checksums
849cb84e514af40940f9d108ec95b049fdd72fdc3b1eb2424f3f3010bff1ac7f
BLAKE2b-256 checksum
How to use checksums
5201b6c3a3a6f3af4e237448612000ab5c1ad2db95a4a48a4aea392c2004f009
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / pinecone_db_construct-0.0.10-py3-none-any.whl

Download URL pinecone_db_construct-0.0.10-py3-none-any.whl
Size 58.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
972f90dae8467242682eea98f4224c315b698698f51c603828214681a99158ce
BLAKE2b-256 checksum
How to use checksums
26915d0f651ecdc1be329fe1dff35a6b98fae0af2a903f07c66a755eef1ea465
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

Release history Release notifications | RSS feed

This release

0.0.10 This release

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page