CreateEnvironment - Amazon Managed Workflows for Apache Airflow

CreateEnvironment

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

Request Syntax

PUT /environments/Name HTTP/1.1 Content-type: application/json { "AirflowConfigurationOptions": { "string" : "string" }, "AirflowVersion": "string", "DagS3Path": "string", "EnvironmentClass": "string", "ExecutionRoleArn": "string", "KmsKey": "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" ], "SubnetIds": [ "string" ] }, "PluginsS3ObjectVersion": "string", "PluginsS3Path": "string", "RequirementsS3ObjectVersion": "string", "RequirementsS3Path": "string", "Schedulers": number, "SourceBucketArn": "string", "Tags": { "string" : "string" }, "WebserverAccessMode": "string", "WeeklyMaintenanceWindowStart": "string" }

URI Request Parameters

The request uses the following URI parameters.

Name

The name of the 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. To learn more, 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. If no value is specified, defaults to the latest version. Valid values: 1.10.12, 2.0.2. To learn more, see Apache Airflow versions on Amazon Managed Workflows for Apache Airflow (MWAA).

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. To learn more, see Adding or updating DAGs.

Type: String

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

Pattern: .*

Required: Yes

EnvironmentClass

The environment class type. Valid values: mw1.small, mw1.medium, mw1.large. To learn more, 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 for your environment. An execution role is an AWS Identity and Access Management (IAM) role that grants MWAA permission to access AWS services and resources used by your environment. For example, arn:aws:iam::123456789:role/my-execution-role. To learn more, 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: Yes

KmsKey

The AWS Key Management Service (KMS) key to encrypt the data in your environment. You can use an AWS owned CMK, or a Customer managed CMK (advanced). To learn more, see Create an Amazon MWAA environment.

Type: String

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

Pattern: ^(((arn:aws(-[a-z]+)?:kms:[a-z]{2}-[a-z]+-\d:\d+:)?key\/)?[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}|(arn:aws(-[a-z]+)?:kms:[a-z]{2}-[a-z]+-\d:\d+:)?alias/.+)$

Required: No

LoggingConfiguration

Defines the Apache Airflow logs 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. To learn more, see About networking on Amazon MWAA.

Type: NetworkConfiguration object

Required: Yes

PluginsS3ObjectVersion

The version of the plugins.zip file on your Amazon S3 bucket. A version must be specified each time a plugins.zip file is updated. To learn more, 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. To learn more, 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. A version must be specified each time a requirements.txt file is updated. To learn more, 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. To learn more, 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 environment. Valid values:

  • v2.0.2 - Accepts between 2 to 5. Defaults to 2.

  • v1.10.12 - Accepts 1.

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. To learn more, 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: Yes

Tags

The key-value tag pairs you want to associate to your environment. For example, "Environment": "Staging". To learn more, see Tagging AWS resources.

Type: String to string map

Map Entries: Maximum number of 50 items.

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

Key Pattern: ^([\p{L}\p{Z}\p{N}_.:/=+\-@]*)$

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

Value Pattern: ^([\p{L}\p{Z}\p{N}_.:/=+\-@]*)$

Required: No

WebserverAccessMode

The Apache Airflow Web server access mode. To learn more, 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) returned in the response for the environment.

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

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: