aws-opensearchservice: Add OpenSearch custom package Resource and associated utils
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 71
Description
### Describe the feature
Add support for instantiating OpenSearch custom package resources, usable when defining a Domain resource as well as for associating a package with existing domain resources.
### Use Case
I'm looking to consistently use CDK to deploy/update my infrastructure rather than have a console-cdk hybrid in some cases, which has to be the case for my use of OpenSearch custom packages given the lack of CDK support at present.
### Proposed Solution
```ts
// Define the S3 bucket containing the packages
const packagesBucket = s3.Bucket.fromBucketName(this, 'Bucket', 'my-packages');
// Define a custom package
const stopwords = new os.CustomPackage(this, 'StopWords', {
packageName: 'stopwords',
s3Bucket: packagesBucket,
s3Key: 'stopwords.txt',
hotReload: true,
});
// Reference an existing custom package
const synonyms = os.CustomPackage.fromCustomPackageAttributes(this, 'Synonyms', {
packageArn: 'arn:aws:es:us-east-1:XXXX:domain/my-custom-package',
});
// Define an OpenSearch domain with pckages inline
new os.Domain(this, 'Domain', {
...
packages: [
stopwords,
synonyms,
],
});
// Associate with an existing domain
const domain = os.Domain.fromDomainAttributes(this, 'MyDomain', {
domainArn: 'arn:aws:es:us-east-1:XXXX:domain/my-domain',
});
domain.associatePackages(stopwords, synonyms);
```
### Other Information
A CustomPackage Resource seems seems like a happy-path use case lacking simply pending further rollout of CDK support for OpenSearch. I'm currently using the console to get around this.
I imagine a custom Resource that wields CLI might be approachable but I haven't looked into it, especially since I'd expect this will be supported as an official Resource sooner rather than later.
### Acknowledgements
- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
2.117
### Environment details (OS name and version, etc.)
MacOS Sonoma 12.4 M1 Max
Contributor guide
Research direction
Start with the aws-opensearchservice Domain construct and the proposed CustomPackage, fromCustomPackageAttributes, and associatePackages entry points. Compare the requested package creation, import, inline-domain, and existing-domain association flows with the CDK version in use. Done means these flows are supported for OpenSearch custom packages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100