A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.amplify.aws/gen1/react/build-a-backend/graphqlapi/modify-amplify-generated-resources/ below:

Website Navigation


Modify Amplify-generated resources - React

Modify Amplify-generated resources

Amplify GraphQL API uses a variety of auto-generated, underlying AWS services and resources. You can customize these underlying resources to optimize the deployed stack for your specific use case.

Run the command above to override Amplify-generated GraphQL API resources including AWS AppSync API, Amazon DynamoDB table, Amazon OpenSearch domain, and more.

The command creates a new overrides.ts file under amplify/backend/api/<resource-name>/ which provides you the Amplify-generated resources as CDK constructs.

In your CDK project, you can access every underlying resource as an "L2" or "L1" construct. Access the generated resources as L2 constructs via the .resources property on the returned stack or access the generated resources as L1 constructs using the .resources.cfnResources property.

Customize Amplify-generated AppSync GraphQL API resources

Apply all the overrides in the override(...) function. For example to enable X-Ray tracing for the AppSync GraphQL API:

You can override the following GraphQL API resources that Amplify generates:

Apply all the customizations on .resources.graphqlApi or .resources.cfnResources.cfnGraphqlApi. For example to enable X-Ray tracing for the AppSync GraphQL API:

Customize Amplify-generated resources for @model directive

Apply all the overrides in the override(...) function. Pass in the @model type name into resources.models[...] to modify the resources generated for that particular @model type. For example, to enable time-to-live on the Todo @model type's DynamoDB table:

You can override the following @model directive resources that Amplify generates:

For example, you can override a model generated DynamoDB table configuration.

Apply all the customizations on .resources.tables["MODEL_NAME"] or .resources.cfnResources.cfnTables["MODEL_NAME"]. Pass in the @model type name into .resources.cfnResources.cfnTables["MODEL_NAME"] to modify the resources generated for that particular @model type. For example, to enable time-to-live on the Todo @model type's DynamoDB table:

Example - Configure DynamoDB table's billing mode

Set the DynamoDB billing mode for the DynamoDB table. Either "PROVISIONED" or "PAY_PER_REQUEST".

Example - Configure provisioned throughput for DynamoDB table or Global Secondary Index

Override the default ProvisionedThroughput provisioned for each @model table and its Global Secondary Indexes (GSI).

Only valid if the "DynamoDBBillingMode" is set to "PROVISIONED"

Example - Enable point-in-time recovery for DynamoDB table

Enable/disable DynamoDB point-in-time recovery for each @model table.

Customize Amplify-generated resources for @searchable (OpenSearch) directive

Apply all the overrides in the override(...) function. For example, to modify the OpenSearch instance count:

You can override the following @searchable directive resources that Amplify generates:

Example - Configure Runtime for Streaming Lambda

You can define the runtime for the @searchable by setting the runtime value on the function object itself. This can be done to resolve a deprecated runtime in the event that you cannot upgrade your version of the Amplify CLI.

Example - Configure OpenSearch Streaming function name

Override the name of the AWS Lambda searchable streaming function

Example - Configure OpenSearch instance version

Override the elasticsearchVersion in the OpenSearch domain created by @searchable

Example - Configure OpenSearch instance type

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

Example - Configure OpenSearch instance count

Override the number of instances launched into the OpenSearch domain created by @searchable

Example - Configure OpenSearch EBS volume size

Override the amount of disk space allocated to each instance in the OpenSearch domain created by @searchable

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:

You can override the following @predictions directive resources that Amplify generates:

Place AppSync Resolvers in Custom-named Stacks

If you have a particularly large GraphQL schema, you may run into issues with too many resources defined in a stack. The most common case where this happens is in the ConnectionStack which contains the resolvers for all of the relational directives in the schema.

Creating a stack mapping does not create an additional root stack for the Amplify environment. All mapped stacks will still be placed under the existing Amplify environment root stack. To map a resolver to a different stack, update <project root>/amplify/api/<api name>/transform.conf.json with a "StackMapping" block. The StackMapping defines a map from resolver logical ID to stack name.

The easiest way to determine a resolver logical ID is to run amplify api gql-compile and note the resolver logical ID in the list of Resources in the generated CloudFormation stack. Resolvers for model operations will be of the form <Get | List | Create | Update | Delete><model name>Resolver. Resolvers for relational directives are of the form <model name><field name>Resolver.

Example

Given the following schema:

To map the CreatePostResolver and the relational resolvers to a stack named 'MyCustomStack', add the following in transform.conf.json:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4