Skip to content
GitHubXDiscord

Api

The Api resource allows you to manage AWS AppSync Apis for building scalable GraphQL applications. With AppSync, you can easily connect your applications to data sources, manage real-time subscriptions, and handle offline scenarios.

Create a basic AppSync API with a name and owner contact.

import AWS from "alchemy/aws/control";
const basicApi = await AWS.AppSync.Api("basicApi", {
name: "MyAppSyncAPI",
ownerContact: "admin@example.com"
});

Configure an AppSync API with event configurations and tags for better management and monitoring.

const advancedApi = await AWS.AppSync.Api("advancedApi", {
name: "MyAdvancedAppSyncAPI",
ownerContact: "support@example.com",
eventConfig: {
// Configure event settings here
// For example, you can set up logging or monitoring configurations
},
tags: [
{ Key: "Environment", Value: "Production" },
{ Key: "Team", Value: "Development" }
]
});

If you want to adopt an existing AppSync API instead of failing when it already exists, you can set the adopt property.

const adoptedApi = await AWS.AppSync.Api("adoptedApi", {
name: "ExistingAppSyncAPI",
adopt: true // This will adopt the existing resource
});