[ aws . amplifygen3 . env ]

edit

Description

Change the settings of one environment: its IAM role and permissions, how new deployments roll out, log sampling, its backend auth settings, database size and backup retention, and which Git branches it deploys from. Pass one or more setting flags to change them in a single update. With no setting flags, the command shows the current settings and lets you pick which to change; in CI (CI=true), where it cannot prompt, it fails instead.

Logs delivered to Amazon S3 need a bucket: name your own with –access-log-s3-bucket, –firewall-log-s3-bucket or –database-log-s3-bucket, or pass –managed-bucket to use the app’s managed bucket for each log type: the one its other environments deliver to, or a new one when none has it yet. Once an environment has a bucket, it is kept until you name another.

The Git flags (–git-branch, –deploy-on-push, –deploy-on-pull-request, –deploy-on-fork-pull-request) need the app to be connected to a Git repository; connect one with aws amplifygen3 app edit --git.

Synopsis

  edit
[--env <value>]
[--role-arn <value>]
[--skew-protection <value>]
[--auto-promote <value>]
[--access-log-cwl-sampling-rate <value>]
[--access-log-s3-sampling-rate <value>]
[--firewall-log-cwl-sampling-rate <value>]
[--firewall-log-s3-sampling-rate <value>]
[--firewall-log-scope <value>]
[--database-log-cwl-sampling-rate <value>]
[--database-log-s3-sampling-rate <value>]
[--access-log-s3-bucket <value>]
[--firewall-log-s3-bucket <value>]
[--database-log-s3-bucket <value>]
[--managed-bucket]
[--skew-cookie-max-age <value>]
[--auth-config <value>]
[--backup-retention-days <value>]
[--max-backend-capacity-units <value>]
[--rollout <value>]
[--role-permissions-mode <value>]
[--git-branch <value>]
[--deploy-on-push <value>]
[--deploy-on-pull-request <value>]
[--deploy-on-fork-pull-request <value>]
[--app <value>]
[--config <value>]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--cli-binary-format <value>]
[--no-cli-pager]
[--cli-auto-prompt]
[--no-cli-auto-prompt]
[--cli-error-format <value>]
[--help]

Options

--env (string) Environment to edit. Defaults to preview. Shorthand: -e.

--role-arn (string) ARN of the IAM role your app runs as in this environment.

--skew-protection (string) ‘enable’ or ‘disable’. When enabled, a visitor keeps being served by the deployment their page was loaded from, so a new deployment does not break pages that are already open.

  • enable
  • disable

--auto-promote (string) ‘enable’ or ‘disable’. When enabled, each new deployment becomes the active deployment once it succeeds. When disabled, a new deployment becomes active only after you run aws amplifygen3 deployment promote.

  • enable
  • disable

--access-log-cwl-sampling-rate (string) Percentage of requests (0 to 100) recorded in the access logs sent to CloudWatch Logs. 0 turns these logs off.

--access-log-s3-sampling-rate (string) Percentage of requests (0 to 100) recorded in the access logs sent to Amazon S3. 0 turns these logs off.

--firewall-log-cwl-sampling-rate (string) Percentage of requests (0 to 100) recorded in the firewall (AWS WAF) logs sent to CloudWatch Logs. 0 turns these logs off.

--firewall-log-s3-sampling-rate (string) Percentage of requests (0 to 100) recorded in the firewall (AWS WAF) logs sent to Amazon S3. 0 turns these logs off.

--firewall-log-scope (string) Which requests the firewall logs record: ‘all-requests’ or ‘blocked-only’. The environment must have a firewall log sampling rate, set in this command or earlier.

  • all-requests
  • blocked-only

--database-log-cwl-sampling-rate (string) Percentage of the backend’s database (Postgres) log lines (0 to 100) delivered to CloudWatch Logs. 0 turns these logs off. Database log delivery is available only in some AWS Regions; where it is not available, the service rejects the change and explains why.

--database-log-s3-sampling-rate (string) Percentage of the backend’s database (Postgres) log lines (0 to 100) delivered to Amazon S3. 0 turns these logs off. Database log delivery is available only in some AWS Regions; where it is not available, the service rejects the change and explains why.

--access-log-s3-bucket (string) Amazon S3 bucket the access logs are delivered to, as a bucket name or an ARN (arn:aws:s3:::my-bucket). Pass it together with –access-log-s3-sampling-rate with a rate above 0, or with another change that keeps S3 delivery of these logs on. If omitted, the bucket the environment already uses is kept; an environment with none needs this flag or –managed-bucket. The bucket policy must let CloudWatch Logs (delivery.logs.amazonaws.com) write to the bucket.

--firewall-log-s3-bucket (string) Amazon S3 bucket the firewall (AWS WAF) logs are delivered to, as a bucket name or an ARN (arn:aws:s3:::my-bucket). Pass it together with –firewall-log-s3-sampling-rate with a rate above 0, or with another change that keeps S3 delivery of these logs on. If omitted, the bucket the environment already uses is kept; an environment with none needs this flag or –managed-bucket. The bucket policy must let CloudWatch Logs (delivery.logs.amazonaws.com) write to the bucket.

--database-log-s3-bucket (string) Amazon S3 bucket the database (Postgres) logs are delivered to, as a bucket name or an ARN (arn:aws:s3:::my-bucket). Pass it together with –database-log-s3-sampling-rate with a rate above 0, or with another change that keeps S3 delivery of these logs on. If omitted, the bucket the environment already uses is kept; an environment with none needs this flag or –managed-bucket. The bucket policy must let CloudWatch Logs (delivery.logs.amazonaws.com) write to the bucket.

--managed-bucket (boolean) Deliver each log type this command sends to Amazon S3 without a bucket flag to the app’s managed bucket for that log type. There is one per log type, shared by the app’s environments: when another environment of the app already delivers these logs to its managed bucket, that bucket is reused. Otherwise the command creates one in your account regional namespace, where only your account can create buckets, named ag3-<type>-logs-<app>-<account>-<region>-an (for example ag3-firewall-logs-my-app-111122223333-us-east-1-an). When the app name does not fit the 63 characters of a bucket name, it is shortened and followed by an 8-character hash of the full app name. A new bucket blocks public access, uses SSE-S3 encryption, and lets only CloudWatch Logs deliveries from your account write to it.

--skew-cookie-max-age (string) How long, in seconds (0 to 604800), a visitor keeps being served by the deployment their page was loaded from. Only meaningful with skew protection on. Supply it together with –skew-protection enable the first time you turn protection on for an environment that has no stored value, which the service rejects otherwise.

--auth-config (string) Path to this environment’s auth config file, the same JSONC object as backend.auth in amplify.jsonc. The file is checked against the auth config schema before anything is sent, and its comments are stripped on the way. An empty file resets the environment to the backend’s default auth settings. The setting is stored now and applied by the environment’s next deployment. A secret belongs in a backend environment variable, referenced from the file as ${env:NAME}, never written in it. The variable has to exist in this environment already, and be both backend-scoped and secret, or the service rejects the config: create it first with aws amplifygen3 var set NAME --secret --scope BACKEND.

--backup-retention-days (string) How many days of backups the backend database keeps in this environment, 1 to 35. Your plan may allow fewer than 35. Stored now and applied by the environment’s next deployment, which is also when it starts widening what backend restore-window reports.

--max-backend-capacity-units (string) Ceiling the backend database may scale up to in this environment, in backend capacity units (BCUs), 1 to 256. The database’s usage is reported in BCU-hours. Your plan may allow fewer than 256. Stored now and applied by the environment’s next deployment.

--rollout (string) How new deployments take over traffic in this environment. ‘instant’ moves all traffic at once. ‘canary-10pct-5m’, ‘canary-10pct-15m’, and ‘canary-10pct-30m’ send 10% of traffic to the new deployment for 5, 15, or 30 minutes, then the rest. ‘linear-10pct-1m’, ‘linear-10pct-3m’, and ‘linear-10pct-10m’ add 10% of traffic every 1, 3, or 10 minutes. Only ‘instant’ is allowed on the preview environment.

  • instant
  • canary-10pct-5m
  • canary-10pct-15m
  • canary-10pct-30m
  • linear-10pct-1m
  • linear-10pct-3m
  • linear-10pct-10m

--role-permissions-mode (string) How much of its IAM role your app can use: ‘scoped’ (the default) or ‘full’. ‘scoped’ limits the role to what the app’s integrations need. ‘full’ gives the app every permission attached to the role; use it for custom integrations, or when the scoped policy would be longer than the 2,048-character limit AWS sets for it.

--git-branch (string) Branch this environment deploys from, or a pattern that matches several branches. Repeat the flag for more (up to 50); the values replace the current list rather than adding to it. Pass “” to stop tracking branches.

--deploy-on-push (string) ‘enable’ or ‘disable’. Deploy automatically when commits are pushed to a tracked branch. To enable it, the environment must track a branch (–git-branch, in this command or earlier).

  • enable
  • disable

--deploy-on-pull-request (string) ‘enable’ or ‘disable’. Build a preview for each pull request from the same repository that targets a tracked branch. To enable it, the environment must track a branch (–git-branch, in this command or earlier).

  • enable
  • disable

--deploy-on-fork-pull-request (string) ‘enable’ or ‘disable’. Build a preview for each pull request from a forked repository that targets a tracked branch. Because the code comes from outside your repository, each commit builds only after you run aws amplifygen3 deployment authorize. To enable it, the environment must track a branch (–git-branch, in this command or earlier). An app with a backend can’t enable it, because a fork’s code would run against the backend’s databases.

  • enable
  • disable

--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.

Global Options

--debug (boolean)

Turn on debug logging.

--endpoint-url (string)

Override command’s default URL with the given URL.

--no-verify-ssl (boolean)

By default, the AWS CLI uses SSL when communicating with AWS services. For each SSL connection, the AWS CLI will verify SSL certificates. This option overrides the default behavior of verifying SSL certificates.

--no-paginate (boolean)

Disable automatic pagination. If automatic pagination is disabled, the AWS CLI will only make one call, for the first page of results.

--output (string)

The formatting style for command output.

  • json
  • text
  • table
  • yaml
  • yaml-stream
  • off

--query (string)

A JMESPath query to use in filtering the response data.

--profile (string)

Use a specific profile from your credential file.

--region (string)

The region to use. Overrides config/env settings.

--version (string)

Display the version of this tool.

--color (string)

Turn on/off color output.

  • on
  • off
  • auto

--no-sign-request (boolean)

Do not sign requests. Credentials will not be loaded if this argument is provided.

--ca-bundle (string)

The CA certificate bundle to use when verifying SSL certificates. Overrides config/env settings.

--cli-read-timeout (int)

The maximum socket read time in seconds. If the value is set to 0, the socket read will be blocking and not timeout. The default value is 60 seconds.

--cli-connect-timeout (int)

The maximum socket connect time in seconds. If the value is set to 0, the socket connect will be blocking and not timeout. The default value is 60 seconds.

--cli-binary-format (string)

The formatting style to be used for binary blobs. The default format is base64. The base64 format expects binary blobs to be provided as a base64 encoded string. The raw-in-base64-out format preserves compatibility with AWS CLI V1 behavior and binary values must be passed literally. When providing contents from a file that map to a binary blob fileb:// will always be treated as binary and use the file contents directly regardless of the cli-binary-format setting. When using file:// the file contents will need to properly formatted for the configured cli-binary-format.

  • base64
  • raw-in-base64-out

--no-cli-pager (boolean)

Disable cli pager for output.

--cli-auto-prompt (boolean)

Automatically prompt for CLI input parameters.

--no-cli-auto-prompt (boolean)

Disable automatically prompt for CLI input parameters.

--cli-error-format (string)

The formatting style for error output. By default, errors are displayed in enhanced format.

  • legacy
  • json
  • yaml
  • text
  • table
  • enhanced

--help (boolean)

Display help for the command/subcommand.

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 change how new deployments roll out

The following env edit example switches an environment to a gradual rollout, so a new deployment takes traffic in stages instead of all at once. Pass several setting flags to change them in one update.

aws amplifygen3 env edit \
    --app my-app \
    --env production \
    --rollout linear-10pct-10m

Output:

Updated environment 'production' in app 'my-app'
  - rollout: linear-10pct-10m

Example 2: To deploy an environment from a Git branch

The following env edit example tracks a branch and deploys on every push to it. The Git flags require the app to be connected to a repository.

aws amplifygen3 env edit \
    --app my-app \
    --env production \
    --git-branch main \
    --deploy-on-push enable

Output:

Updated environment 'production' in app 'my-app'
  - git-branch:     main
  - deploy-on-push: enable

Example 3: To change the IAM role of an environment

The following env edit example points the environment at a role you manage.

aws amplifygen3 env edit \
    --app my-app \
    --env production \
    --role-arn arn:aws:iam::123456789012:role/my-amplify-role

Output:

Updated environment 'production' in app 'my-app'
  - role-arn: arn:aws:iam::123456789012:role/my-amplify-role

Example 4: To deliver access logs to Amazon S3

The following env edit example delivers 10 percent of requests to Amazon S3 in the access logs. --managed-bucket uses the app’s managed bucket for them: the one another environment of the app already delivers its access logs to, or a new one in your account regional namespace, named ag3-access-logs-<app>-<account>-<region>-an. To use your own bucket instead, pass --access-log-s3-bucket with its name or ARN.

aws amplifygen3 env edit \
    --app my-app \
    --env production \
    --access-log-s3-sampling-rate 10 \
    --managed-bucket

Output:

Updated environment 'production' in app 'my-app'
  - access-log-s3-sampling-rate: 10
  - access-log-s3-bucket:        arn:aws:s3:::ag3-access-logs-my-app-123456789012-us-west-2-an (new managed bucket)

To see the current settings without changing them, use aws amplifygen3 env get.