Skip to content

add Opensearch config parameters override samples #5291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 66 additions & 1 deletion src/pages/cli/graphql/override.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,71 @@ export function override(resources: AmplifyApiGraphQlResourceStackTemplate) {
}
```

### Example - Configure OpenSearch Streaming function name
Override the name of the AWS Lambda searchable streaming function

```ts
import { AmplifyApiGraphQlResourceStackTemplate } from '@aws-amplify/cli-extensibility-helper';

export function override(resources: AmplifyApiGraphQlResourceStackTemplate) {
resources.opensearch.OpenSearchStreamingLambdaFunction.FunctionName = 'CustomFunctionName';
}

```

### Example - Configure OpenSearch instance version

Override the `elasticsearchVersion` in the OpenSearch domain created by `@searchable`

```ts
import { AmplifyApiGraphQlResourceStackTemplate } from '@aws-amplify/cli-extensibility-helper';

export function override(resources: AmplifyApiGraphQlResourceStackTemplate) {
resources.opensearch.OpenSearchDomain.elasticsearchVersion = 'OpenSearch_1.3';
}
```
### Example - Configure OpenSearch instance type

Override the type of instance launched into the OpenSearch domain created by `@searchable`

```ts
import { AmplifyApiGraphQlResourceStackTemplate } from '@aws-amplify/cli-extensibility-helper';

export function override(resources: AmplifyApiGraphQlResourceStackTemplate) {
resources.opensearch.OpenSearchDomain.elasticsearchClusterConfig = {
...resources.opensearch.OpenSearchDomain.elasticsearchClusterConfig,
instanceType: "m3.medium.elasticsearch",
};
}
```
### Example - Configure OpenSearch instance count
Override the number of instances launched into the OpenSearch domain created by `@searchable`

```ts
import { AmplifyApiGraphQlResourceStackTemplate } from '@aws-amplify/cli-extensibility-helper';

export function override(resources: AmplifyApiGraphQlResourceStackTemplate) {
resources.opensearch.OpenSearchDomain.elasticsearchClusterConfig = {
...resources.opensearch.OpenSearchDomain.elasticsearchClusterConfig,
instanceCount : 2
};
}
```

### Example - Configure OpenSearch EBS volume size
Override the amount of disk space allocated to each instance in the OpenSearch domain created by `@searchable`

```ts
import { AmplifyApiGraphQlResourceStackTemplate } from '@aws-amplify/cli-extensibility-helper';

export function override(resources: AmplifyApiGraphQlResourceStackTemplate) {
resources.opensearch.OpenSearchDomain.ebsOptions={
...resources.opensearch.OpenSearchDomain.ebsOptions,
volumeSize:10
}
}
```

## Customize Amplify-generated resources for @predictions directive

Apply all the overrides in the `override(...)` function. For example, to add a Path to IAM role that facilitates text translation:
Expand Down Expand Up @@ -197,4 +262,4 @@ To map the CreatePostResolver and the relational resolvers to a stack named 'MyC
"BlogpostsResolver": "MyCustomStack",
"PostblogResolver": "MyCustomStack",
}
```
```