Name:
interface
Value:
Extend your Amplify Gen 2 app with AWS Blocks — self-contained backend capabilities you compose into your existing backend.
Gen1 DocsLegacy

Page updated Mar 3, 2025

NewDeploy web apps with Git or your AI coding agent using the latest AWS Amplify. Add managed databases and authentication as you grow. Explore the documentation.
NoticeAmplify Gen 1 has entered maintenance mode and will reach end of life on May 1, 2027.

Disable Operations

These docs cover Amplify Gen 2. For new web apps, we recommend the latest AWS Amplify, with a simplified CLI and native integrations for databases, storage, and AI models. Get started with the latest AWS Amplify.

The disableOperations method allows you to selectively disable specific GraphQL operations for a model in your Amplify application. This can be useful for implementing specialized API designs and reduce the number of resources being deployed.

You can disable operations by adding the disableOperations method to your model definition:

amplify/data/resource.ts
export const schema = a.schema({
Customer: a
.model({
name: a.string(),
phoneNumber: a.phone(),
accountRepresentativeId: a.id().required(),
})
.disableOperations(["mutations", "subscriptions", "queries"])
.authorization(allow => [allow.publicApiKey()]),
});

Available Operation Types

The disableOperations method accepts an array of operation types that you want to disable:

General Operation Categories

  • mutations: Disables all mutation operations (create, update, delete)
  • subscriptions: Disables all real-time subscription operations (onCreate, onUpdate, onDelete)
  • queries: Disables all query operations (get, list)

Specific Operations

You can also disable more granular operations: Query Operations

  • get: Disables the ability to fetch a single item by ID
  • list: Disables the ability to fetch multiple items

Mutation Operations

  • create: Disables the ability to create new items
  • update: Disables the ability to update existing items
  • delete: Disables the ability to delete items

Subscription Operations

  • onCreate: Disables real-time notifications when items are created
  • onUpdate: Disables real-time notifications when items are updated
  • onDelete: Disables real-time notifications when items are deleted

You can specify one or more operation types in the array to disable them:

// Disable all mutations
disableOperations: ["mutations"]
// Disable both subscriptions and queries
disableOperations: ["subscriptions", "queries"]
// Disable specific operations
disableOperations: ["create", "update", "list"]
// Disable specific subscription types
disableOperations: ["onCreate", "onUpdate"]
// Mix general categories with specific operations
disableOperations: ["queries", "create", "onDelete"]