ListBackendEnvironmentsCommand

Lists the backend environments for an Amplify app.

This API is available only to Amplify Gen 1 applications where the backend is created using Amplify Studio or the Amplify command line interface (CLI). This API isn’t available to Amplify Gen 2 applications. When you deploy an application with Amplify Gen 2, you provision the app's backend infrastructure using Typescript code.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { AmplifyClient, ListBackendEnvironmentsCommand } from "@aws-sdk/client-amplify"; // ES Modules import
// const { AmplifyClient, ListBackendEnvironmentsCommand } = require("@aws-sdk/client-amplify"); // CommonJS import
const client = new AmplifyClient(config);
const input = { // ListBackendEnvironmentsRequest
  appId: "STRING_VALUE", // required
  environmentName: "STRING_VALUE",
  nextToken: "STRING_VALUE",
  maxResults: Number("int"),
};
const command = new ListBackendEnvironmentsCommand(input);
const response = await client.send(command);
// { // ListBackendEnvironmentsResult
//   backendEnvironments: [ // BackendEnvironments // required
//     { // BackendEnvironment
//       backendEnvironmentArn: "STRING_VALUE", // required
//       environmentName: "STRING_VALUE", // required
//       stackName: "STRING_VALUE",
//       deploymentArtifacts: "STRING_VALUE",
//       createTime: new Date("TIMESTAMP"), // required
//       updateTime: new Date("TIMESTAMP"), // required
//     },
//   ],
//   nextToken: "STRING_VALUE",
// };

ListBackendEnvironmentsCommand Input

Parameter
Type
Description
appId
Required
string | undefined

The unique ID for an Amplify app.

environmentName
string | undefined

The name of the backend environment

maxResults
number | undefined

The maximum number of records to list in a single response.

nextToken
string | undefined

A pagination token. Set to null to start listing backend environments from the start. If a non-null pagination token is returned in a result, pass its value in here to list more backend environments.

ListBackendEnvironmentsCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
backendEnvironments
Required
BackendEnvironment[] | undefined

The list of backend environments for an Amplify app.

nextToken
string | undefined

A pagination token. If a non-null pagination token is returned in a result, pass its value in another request to retrieve more entries.

Throws

Name
Fault
Details
BadRequestException
client

A request contains unexpected data.

InternalFailureException
server

The service failed to perform an operation due to an internal issue.

UnauthorizedException
client

An operation failed due to a lack of access.

AmplifyServiceException
Base exception class for all service exceptions from Amplify service.