Skip to main content

Custom Resources Library for Amazon OpenSearch Service

An AWS CDK construct library to manage OpenSearch resources via CloudFormation custom resource. This is especially useful if you use fine-grained access control feature on OpenSearch, where you have to create resources such as role or role mapping via OpenSearch REST API.

architecture

Currently supported resources

You can manage any other REST resources via our low level API (ResourceBase class).

Usage

Install it via npm:

npm install opensearch-rest-resources

Then you can create OpenSearch resources using Domain construct.

import { IVpc } from 'aws-cdk-lib/aws-ec2';
import { IRole } from 'aws-cdk-lib/aws-iam';
import { Domain } from 'aws-cdk-lib/aws-opensearchservice';
import { OpenSearchRole, OpenSearchRoleMapping } from 'opensearch-rest-resources';

declare const vpc: IVpc;
declare const backendRole: IRole;
declare const domain: Domain;

const role = new OpenSearchRole(this, 'Role1', {
    vpc,
    domain,
    roleName: 'Role1',
    payload: {
        clusterPermissions: ['indices:data/write/bulk'],
        indexPermissions: [
            {
                indexPatterns: ['*'],
                allowedActions: ['read', 'write', 'index', 'create_index'],
            },
        ],
    }
});

const roleMapping = new OpenSearchRoleMapping(this, 'RoleMapping1', {
    vpc,
    domain,
    roleName: role.roleName,
    payload: {
        backendRoles: [backendRole.roleArn],
    },
    removalPolicy: RemovalPolicy.RETAIN,
});

Limitation

Currently this library assumes your OpenSearch domain is configured such that:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "*"
      },
      "Action": "es:ESHttp*",
      "Resource": "domain-arn/*"
    }
  ]
}

Most of the above follow the current operational best practices of Amazon OpenSearch Service. If you want other configuration supported, please submit an issue.

Metadata

Release files for opensearch-rest-resources 0.0.13

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

Source distribution (sdist)

Source distribution for opensearch-rest-resources 0.0.13
File Size Uploaded Provenance Actions
opensearch_rest_resources-0.0.13.tar.gz 1.1 MB Without provenance Details for opensearch_rest_resources-0.0.13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opensearch-rest-resources 0.0.13
File Interpreter ABI Platform Actions
opensearch_rest_resources-0.0.13-py3-none-any.whl Python 3 none any Details for opensearch_rest_resources-0.0.13-py3-none-any.whl

Total release size: 2.2 MB

Release files / opensearch_rest_resources-0.0.13.tar.gz

Download URL opensearch_rest_resources-0.0.13.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
bb6d000c2f5a0ef4cc04a725855d51d2942bf1386c3016c998cb06ea691c2a6f
BLAKE2b-256 checksum
How to use checksums
b561a13e869a12b21a5b671ac49c8c9d1f22cf446592bfd2db6176f0a00a353e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / opensearch_rest_resources-0.0.13-py3-none-any.whl

Download URL opensearch_rest_resources-0.0.13-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
dd4e6519f63532019042cd0a38e433265ffb129a667e59703a8776fa2e3fb1a2
BLAKE2b-256 checksum
How to use checksums
1e20bf6246273ad4d508d620a7274c7ba9c3a4c926d531a65717eccf5af63ff0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Security for opensearch-rest-resources 0.0.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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