amplify-category-api
amplify-category-api copied to clipboard
Is OpenSearch serverless possible with Amplify and @searchable?
Amplify CLI Version
12.10.0
Question
Is it possible to configure Amplify in such a way that it will provision a serverless Opensearch when models are tagged with @searchable ?
It was possible but not working right now. I am trying to use opensearch for my amplify app. but it fails.
Hey @fsamir, 👋 thanks for raising this! I'm going to transfer this over to our API repository for better assistance 🙂.
@fsamir We don't currently offer a way to override the instance or cluster type provisioned by the @searchable
directive. However in our CDK-based experience, we offer more direct access to Amplify-generated resources, so it might be possible to override the types at that level. I'll investigate whether that's possible, and take this as a feature request if not.
Much appreciated.
Thanks,
On Wed, 27 Mar 2024 at 2:27 am, Tim Schmelter @.***> wrote:
@fsamir https://github.com/fsamir We don't currently offer a way to override the instance or cluster type provisioned by the @searchable directive. However in our CDK-based experience, we offer more direct access to Amplify-generated resources, so it might be possible to override the types at that level. I'll investigate whether that's possible, and take this as a feature request if not.
— Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-category-api/issues/2379#issuecomment-2020907478, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABFZR77XRZCBR3NPTCCZCTY2GOVHAVCNFSM6AAAAABFHTY3YCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRQHEYDONBXHA . You are receiving this because you were mentioned.Message ID: @.***>
Hey @fazyamir, Based on the error you provided, it appears that you're using an invalid OpenSearch instance type. Could you please try changing the instance type to t2.small.search
and inform us if it resolves your issue? Please refer to this page for supported OpenSearch instance types. https://docs.aws.amazon.com/opensearch-service/latest/developerguide/supported-instance-types.html
Hello @AnilMaktala Thanks for the reply. I cannot change the instance type. When I add the @searchable directive to a model grapgh ql scheme and run amplify push. Then amplify runs these for me. I took screenshot from cloud formation logs when it kept failing. I have read the documentation and have tried following it many times. If there is a workaround please let me know.
Hey @fazyamir, Could you please confirm whether you are utilizing Amplify CLI or CDK? This information will assist us in offering a suitable workaround.
@AnilMaktala I am using Amplify cli.
Hey @fazyamir Thank you for confirming. You have the option to modify the open search instance type using the override functionality detailed here. Please inform us if this resolves your issue.
import { AmplifyApiGraphQlResourceStackTemplate } from '@aws-amplify/cli-extensibility-helper';
export function override(resources: AmplifyApiGraphQlResourceStackTemplate) {
resources.opensearch.OpenSearchDomain.elasticsearchClusterConfig = {
...resources.opensearch.OpenSearchDomain.elasticsearchClusterConfig,
instanceType: 't2.small.search'
};
}
Hello @AnilMaktala sorry for the late reply i was a little caught up in something. I followed the documenttation. But when i create the ovveride.ts file and then use amplify push it fails error is. × There was an error pulling the backend environment devs. 🛑 Packaging overrides failed.
Learn more at: https://docs.amplify.aws/cli/graphql/override/
Session Identifier: 3749fd50-f1a2-455b-be66-50ee8dd4ec5c overide.ts is `import { AmplifyApiGraphQlResourceStackTemplate, AmplifyProjectInfo } from '@aws-amplify/cli-extensibility-helper';
export function override(resources: AmplifyApiGraphQlResourceStackTemplate, amplifyProjectInfo: AmplifyProjectInfo) { resources.opensearch.OpenSearchDomain.elasticsearchClusterConfig = { resources.opensearch.OpenSearchDomain.elasticsearchClusterConfig, instanceType: 't2.small.search' }; } ` Am i missing something in following steps? i used amplify overide api to generate the override file then copied the code to override opensearch instance type then changed type to t2.small.search then used amplify push.
Hey @fazyamir, can you please retry amplify push
after chaging the'resources.opensearch.OpenSearchDomain.elasticsearchClusterConfig
to ...resources.opensearch.OpenSearchDomain.elasticsearchClusterConfig,
and let me know.
Hey @AnilMaktala I have the exact same issue. I get the 🛑 Packaging overrides failed error as well when I run
amplify override api
Here is my override.ts file contents
import { AmplifyApiGraphQlResourceStackTemplate } from "@aws-amplify/cli-extensibility-helper";
export function override(resources: AmplifyApiGraphQlResourceStackTemplate) {
resources.opensearch.OpenSearchDomain.elasticsearchClusterConfig = {
...resources.opensearch.OpenSearchDomain.elasticsearchClusterConfig,
instanceType: "t3.medium.search",
};
}
amplify build --debug
🛑 InvalidOverrideError: Packaging overrides failed.
at /snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-api/lib/index.js:309:23
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async transformCategoryStack (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-api/lib/index.js:308:29)
at async transformResourceWithOverrides (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/override-manager/transform-resource.js:66:9)
at async Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/commands/build.js:27:13)
at async Object.executeAmplifyCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/index.js:194:9)
at async executePluginModuleCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:139:5)
at async executeCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:37:9)
at async Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/index.js:121:5)
🛑 There was an error building the resource
Can't seem to get around it at all
i found the solution. use 't3.small.elasticsearch' instead of 't2.small.search'
the name of instance type was causing issues as these have been changed in opensearch and not in amplify also i think t2 is no longer avalible.
Hey @fazyamir, Thanks for confirming. We will close the issue as the issue is resolved.
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.