UpdateEnvironment - Amazon Managed Workflows for Apache Airflow

UpdateEnvironment

Updates an Amazon Managed Workflows for Apache Airflow (MWAA) environment.

Request Syntax

PATCH /environments/Name HTTP/1.1 Content-type: application/json { "AirflowConfigurationOptions": { "string" : "string" }, "AirflowVersion": "string", "DagS3Path": "string", "EnvironmentClass": "string", "ExecutionRoleArn": "string", "LoggingConfiguration": { "DagProcessingLogs": { "Enabled": boolean, "LogLevel": "string" }, "SchedulerLogs": { "Enabled": boolean, "LogLevel": "string" }, "TaskLogs": { "Enabled": boolean, "LogLevel": "string" }, "WebserverLogs": { "Enabled": boolean, "LogLevel": "string" }, "WorkerLogs": { "Enabled": boolean, "LogLevel": "string" } }, "MaxWorkers": number, "MinWorkers": number, "NetworkConfiguration": { "SecurityGroupIds": [ "string" ] }, "PluginsS3ObjectVersion": "string", "PluginsS3Path": "string", "RequirementsS3ObjectVersion": "string", "RequirementsS3Path": "string", "Schedulers": number, "SourceBucketArn": "string", "StartupScriptS3ObjectVersion": "string", "StartupScriptS3Path": "string", "WebserverAccessMode": "string", "WeeklyMaintenanceWindowStart": "string" }

URI Request Parameters

The request uses the following URI parameters.

Name

The name of your Amazon MWAA environment. For example, MyMWAAEnvironment.

Length Constraints: Minimum length of 1. Maximum length of 80.

Pattern: ^[a-zA-Z][0-9a-zA-Z-_]*$

Required: Yes

Request Body

The request accepts the following data in JSON format.

AirflowConfigurationOptions

A list of key-value pairs containing the Apache Airflow configuration options you want to attach to your environment. For more information, see Apache Airflow configuration options.

Type: String to string map

Key Length Constraints: Minimum length of 1. Maximum length of 64.

Key Pattern: ^[a-z]+([a-z0-9._]*[a-z0-9_]+)?$

Value Length Constraints: Minimum length of 1. Maximum length of 65536.

Value Pattern: ^[ -~]+$

Required: No

AirflowVersion

The Apache Airflow version for your environment. To upgrade your environment, specify a newer version of Apache Airflow supported by Amazon MWAA.

Before you upgrade an environment, make sure your requirements, DAGs, plugins, and other resources used in your workflows are compatible with the new Apache Airflow version. For more information about updating your resources, see Upgrading an Amazon MWAA environment.

Valid values: 1.10.12, 2.0.2, 2.2.2, 2.4.3, 2.5.1, 2.6.3, 2.7.2, 2.8.1.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 32.

Pattern: ^[0-9a-z.]+$

Required: No

DagS3Path

The relative path to the DAGs folder on your Amazon S3 bucket. For example, dags. For more information, see Adding or updating DAGs.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Pattern: .*

Required: No

EnvironmentClass

The environment class type. Valid values: mw1.small, mw1.medium, mw1.large, mw1.xlarge, and mw1.2xlarge. For more information, see Amazon MWAA environment class.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

ExecutionRoleArn

The Amazon Resource Name (ARN) of the execution role in IAM that allows MWAA to access AWS resources in your environment. For example, arn:aws:iam::123456789:role/my-execution-role. For more information, see Amazon MWAA Execution role.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1224.

Pattern: ^arn:aws(-[a-z]+)?:iam::\d{12}:role/?[a-zA-Z_0-9+=,.@\-_/]+$

Required: No

LoggingConfiguration

The Apache Airflow log types to send to CloudWatch Logs.

Type: LoggingConfigurationInput object

Required: No

MaxWorkers

The maximum number of workers that you want to run in your environment. MWAA scales the number of Apache Airflow workers up to the number you specify in the MaxWorkers field. For example, 20. When there are no more tasks running, and no more in the queue, MWAA disposes of the extra workers leaving the one worker that is included with your environment, or the number you specify in MinWorkers.

Type: Integer

Valid Range: Minimum value of 1.

Required: No

MinWorkers

The minimum number of workers that you want to run in your environment. MWAA scales the number of Apache Airflow workers up to the number you specify in the MaxWorkers field. When there are no more tasks running, and no more in the queue, MWAA disposes of the extra workers leaving the worker count you specify in the MinWorkers field. For example, 2.

Type: Integer

Valid Range: Minimum value of 1.

Required: No

NetworkConfiguration

The VPC networking components used to secure and enable network traffic between the AWS resources for your environment. For more information, see About networking on Amazon MWAA.

Type: UpdateNetworkConfigurationInput object

Required: No

PluginsS3ObjectVersion

The version of the plugins.zip file on your Amazon S3 bucket. You must specify a version each time a plugins.zip file is updated. For more information, see How S3 Versioning works.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

PluginsS3Path

The relative path to the plugins.zip file on your Amazon S3 bucket. For example, plugins.zip. If specified, then the plugins.zip version is required. For more information, see Installing custom plugins.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Pattern: .*

Required: No

RequirementsS3ObjectVersion

The version of the requirements.txt file on your Amazon S3 bucket. You must specify a version each time a requirements.txt file is updated. For more information, see How S3 Versioning works.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

RequirementsS3Path

The relative path to the requirements.txt file on your Amazon S3 bucket. For example, requirements.txt. If specified, then a file version is required. For more information, see Installing Python dependencies.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Pattern: .*

Required: No

Schedulers

The number of Apache Airflow schedulers to run in your Amazon MWAA environment.

Type: Integer

Valid Range: Maximum value of 5.

Required: No

SourceBucketArn

The Amazon Resource Name (ARN) of the Amazon S3 bucket where your DAG code and supporting files are stored. For example, arn:aws:s3:::my-airflow-bucket-unique-name. For more information, see Create an Amazon S3 bucket for Amazon MWAA.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1224.

Pattern: ^arn:aws(-[a-z]+)?:s3:::[a-z0-9.\-]+$

Required: No

StartupScriptS3ObjectVersion

The version of the startup shell script in your Amazon S3 bucket. You must specify the version ID that Amazon S3 assigns to the file every time you update the script.

Version IDs are Unicode, UTF-8 encoded, URL-ready, opaque strings that are no more than 1,024 bytes long. The following is an example:

3sL4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo

For more information, see Using a startup script.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

StartupScriptS3Path

The relative path to the startup shell script in your Amazon S3 bucket. For example, s3://mwaa-environment/startup.sh.

Amazon MWAA runs the script as your environment starts, and before running the Apache Airflow process. You can use this script to install dependencies, modify Apache Airflow configuration options, and set environment variables. For more information, see Using a startup script.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Pattern: .*

Required: No

WebserverAccessMode

The Apache Airflow Web server access mode. For more information, see Apache Airflow access modes.

Type: String

Valid Values: PRIVATE_ONLY | PUBLIC_ONLY

Required: No

WeeklyMaintenanceWindowStart

The day and time of the week in Coordinated Universal Time (UTC) 24-hour standard time to start weekly maintenance updates of your environment in the following format: DAY:HH:MM. For example: TUE:03:30. You can specify a start time in 30 minute increments only.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 9.

Pattern: (MON|TUE|WED|THU|FRI|SAT|SUN):([01]\d|2[0-3]):(00|30)

Required: No

Response Syntax

HTTP/1.1 200 Content-type: application/json { "Arn": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

Arn

The Amazon Resource Name (ARN) of the Amazon MWAA environment. For example, arn:aws:airflow:us-east-1:123456789012:environment/MyMWAAEnvironment.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1224.

Pattern: ^arn:aws(-[a-z]+)?:airflow:[a-z0-9\-]+:\d{12}:environment/\w+

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalServerException

InternalServerException: An internal error has occurred.

HTTP Status Code: 500

ResourceNotFoundException

ResourceNotFoundException: The resource is not available.

HTTP Status Code: 404

ValidationException

ValidationException: The provided input is not valid.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: