[ aws . amplifygen3 . integration ]

connect

Description

Connect an integration to one or more environments of an app. To register a resource as a new integration, pass its type first, for example aws amplifygen3 integration connect s3 --name assets --id my-bucket. Run aws amplifygen3 integration connect TYPE help for the flags of a type. The resource must already exist; this command never creates it.

Without a type, the command connects an integration that already exists. Passing a type with the name of an existing integration also connects that integration rather than creating a second one, but it fails if the type or the resource is different, or if you pass –prefix, –tags, or an environment-variable flag. Change an existing integration with aws amplifygen3 integration edit. Connecting to an environment that is already connected does nothing.

If the integration is registered but connecting it fails, the integration is kept; fix the problem and run the command again, or change the integration with aws amplifygen3 integration edit if the fix is to the integration itself. The app gets the integration’s environment variables and access the next time the environment is deployed.

Synopsis

  connect
--name <value>
[--env <value>]
[--app <value>]
[--config <value>]

Options

--name (string) [required] Name of the integration. Shorthand: -n.

--env (string) Environment to connect the integration to. Repeat the flag for several environments, for example -e preview -e production. Defaults to preview. Shorthand: -e.

--app (string) App name. If omitted, the name is read from the config file (amplify.jsonc by default, see –config), then package.json in the current directory, then the current directory name. Shorthand: -a.

--config (string) Path to the configuration file to read the app name from when –app is not passed. Defaults to amplify.jsonc in the current directory. Shorthand: -c.

Available Commands

Examples

Note

To use the following examples, you must have the AWS CLI installed and configured. See the Getting started guide in the AWS CLI User Guide for more information.

Unless otherwise stated, all examples have unix-like quotation rules. These examples will need to be adapted to your terminal’s quoting rules. See Using quotation marks with strings in the AWS CLI User Guide .

Example 1: To connect an existing integration to an environment

The following integration connect example connects an integration that was registered earlier to another environment. No type is passed, so nothing new is registered and the integration’s configuration is unchanged. Use this form to connect an integration that already exists; to register a resource as a new integration, pass its type first – see aws amplifygen3 integration connect s3 help and the other types (bedrock, dsql, custom). No form of this command creates the AWS resource; it must already exist.

aws amplifygen3 integration connect \
    --name uploads-bucket \
    --app my-app \
    --env production

Output:

Connected integration 'uploads-bucket'
Connected to production

--env defaults to preview, so you can leave it out when that is the target.

Example 2: To connect to several environments at once

The following integration connect example repeats --env to connect the same integration to two environments in one call. Each environment is reported on its own line.

aws amplifygen3 integration connect \
    --name uploads-bucket \
    --app my-app \
    --env preview \
    --env production

Output:

Connected integration 'uploads-bucket'
Connected to preview
Connected to production

Example 3: To connect by type when the integration already exists

The following integration connect example passes a type with the name of an existing integration, which connects that integration rather than creating a second one. The command says so, and leaves the configuration alone:

Connected existing S3 integration 'uploads-bucket'
Connected to production

Note: integration 'uploads-bucket' already existed, so it was connected as-is -- no new integration was created and its configuration is unchanged.

This fails, rather than reusing, if the type or the resource is different, or if you pass --prefix, --tags, or an environment-variable flag. To change an existing integration, use aws amplifygen3 integration edit.

Connecting to an environment that is already connected does nothing. If the integration is registered but connecting it fails, the integration is kept – fix the problem and run the command again, or change the integration with aws amplifygen3 integration edit if the fix is to the integration itself.

The app gets the integration’s environment variables and access the next time the environment is deployed.

Examples

Register an existing S3 bucket and connect it to preview:

$ aws amplifygen3 integ connect s3 --name assets --id my-bucket

Register any other AWS resource as a custom integration. The environment must use the full role permissions mode:

$ aws amplifygen3 integ connect custom --name orders-queue \
    --arn arn:aws:sqs:us-east-1:123456789012:orders \
    --integ-env-var QUEUE_URL=https://sqs.us-east-1.amazonaws.com/123456789012/orders

Wire an existing integration to two environments:

$ aws amplifygen3 integ connect --name assets -e preview -e production