Skip to content

Deployment

A CloudFormation template deploys a complete Neptune Analytics + SageMaker notebook environment with a single command.

  • Neptune Analytics graph with configurable provisioned memory
  • SageMaker notebook instance with nx_neptune pre-installed
  • S3 staging bucket with versioning + KMS encryption
  • KMS key for S3 bucket encryption
  • IAM role and policy with Neptune, S3, KMS, Athena, Glue, and SageMaker permissions

Automatically set on the notebook instance:

VariableValue
NETWORKX_GRAPH_IDCreated graph’s ID
AWS_REGIONStack region
NETWORKX_S3_EXPORT_BUCKET_PATHs3://<bucket>/export/
NETWORKX_S3_IMPORT_BUCKET_PATHs3://<bucket>/import/
NETWORKX_STAGING_BUCKETs3://<bucket>/staging
  1. Default deployment (installs from PyPI):

    Terminal window
    ./cloudformation-templates/deploy.sh
  2. Custom stack name and region:

    Terminal window
    ./cloudformation-templates/deploy.sh my-stack us-east-1
  3. Deploy with local wheel:

    Terminal window
    ./cloudformation-templates/deploy.sh nx-neptune-demo us-west-1 true
ArgumentPositionDefaultDescription
STACK_NAME1stnx-neptune-demoStack name (max 16 chars)
REGION2ndus-west-1AWS region
BUILD_WHEEL3rdfalseBuild and deploy local wheel
Terminal window
# Build wheel and zip notebooks
python -m pip wheel -w dist .
zip -r /tmp/notebooks.zip notebooks/
# Upload to S3
aws s3 cp dist/nx_neptune-*.whl s3://your-bucket/nx-neptune/
aws s3 cp /tmp/notebooks.zip s3://your-bucket/nx-neptune/
# Deploy
aws cloudformation deploy \
--stack-name nx-neptune-demo \
--template-file cloudformation-templates/nx-neptune-sagemaker.json \
--capabilities CAPABILITY_NAMED_IAM \
--parameter-overrides AssetsS3Prefix=s3://your-bucket/nx-neptune
ParameterDescriptionDefault
ApplicationIdResource naming prefix (max 16 chars)nx-neptune
ProvisionedMemorym-NCUs for the graph (16, 32, 64)16
PublicConnectivityEnable public connectivitytrue
NotebookInstanceTypeSageMaker instance typeml.t3.medium
AssetsS3PrefixS3 prefix with notebooks.zip and optional .whl(required)
OutputDescription
GraphIdNeptune Analytics graph ID
NotebookURLSageMaker notebook URL
StagingBucketNameS3 bucket for import/export
Terminal window
aws cloudformation describe-stacks --stack-name nx-neptune-demo --query 'Stacks[0].Outputs'
Terminal window
./cloudformation-templates/teardown.sh # defaults
./cloudformation-templates/teardown.sh my-stack us-east-1 # custom
  • Environment variables require a notebook stop/start to update
  • On every notebook start, OnStart re-installs nx_neptune (from the .whl if provided, otherwise from PyPI)