Manage OpenSearch REST resources from AWS CDK.
Project description
Custom Resources Library for Amazon OpenSearch Service
An AWS CDK construct library to manage OpenSearch resources via CloudFormation custom resource.
Currently supported resources
You can manage any other REST resources via our low level API (ResourceBase class).
Usage
Instal 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 { Domain } from 'aws-cdk-lib/aws-opensearchservice';
import { OpenSearchRole, OpenSearchRoleMapping } from 'opensearch-rest-resources';
declare const vpc: IVpc;
declare const role: 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: 'Role1',
payload: {
backendRoles: [role.roleArn],
},
removalPolicy: RemovalPolicy.RETAIN,
});
roleMapping.node.addDependency(role);
Limitation
Currently this library assumes your OpenSearch domain is configured as:
- Fine-grained access control is enabled
- Deployed within a VPC
- Use the
DomainL2 construct - The credential for the master user (username and password) is stored in Secret Manager
- Domain access policy is permissive like below:
{
"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.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opensearch-rest-resources-0.0.3.tar.gz.
File metadata
- Download URL: opensearch-rest-resources-0.0.3.tar.gz
- Upload date:
- Size: 96.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16a2709833bc29b7fe7dc0b004ab347b6d9f9003206e0d72c51cc99ed9c41721
|
|
| MD5 |
2d157a6001a1f624cc866a0b205cc441
|
|
| BLAKE2b-256 |
88b287e4f995f844e8fb7b69f8bf8e0c4220fb4921a1f05508ada6847e0d2a39
|
File details
Details for the file opensearch_rest_resources-0.0.3-py3-none-any.whl.
File metadata
- Download URL: opensearch_rest_resources-0.0.3-py3-none-any.whl
- Upload date:
- Size: 94.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19a6d7c1b1b7a33b30c2ba06a9563690f5405d601374622293f8eeab26ce16d9
|
|
| MD5 |
d1db075a9bb897f1e1223fcedc88a977
|
|
| BLAKE2b-256 |
2f8dbeef5ce317ee88003328ae1bbba5ea0cf7b662f9204818f244ee30c6a9a4
|