CreateEnvironment
Creates an Amazon Managed Workflows for Apache Airflow (Amazon MWAA) environment.
Request Syntax
PUT /environments/Name
HTTP/1.1
Content-type: application/json
{
"AirflowConfigurationOptions": {
"string
" : "string
"
},
"AirflowVersion": "string
",
"DagS3Path": "string
",
"EndpointManagement": "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
"
}
},
"MaxWebservers": number
,
"MaxWorkers": number
,
"MinWebservers": number
,
"MinWorkers": number
,
"NetworkConfiguration": {
"SecurityGroupIds": [ "string
" ],
"SubnetIds": [ "string
" ]
},
"PluginsS3ObjectVersion": "string
",
"PluginsS3Path": "string
",
"RequirementsS3ObjectVersion": "string
",
"RequirementsS3Path": "string
",
"Schedulers": number
,
"SourceBucketArn": "string
",
"StartupScriptS3ObjectVersion": "string
",
"StartupScriptS3Path": "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. 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. If no value is specified, it defaults to the latest version. For more information, see Apache Airflow versions on Amazon Managed Workflows for Apache Airflow (Amazon MWAA).
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
,2.9.2
, and2.10.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: Yes
- EndpointManagement
-
Defines whether the VPC endpoints configured for the environment are created, and managed, by the customer or by Amazon MWAA. If set to
SERVICE
, Amazon MWAA will create and manage the required VPC endpoints in your VPC. If set toCUSTOMER
, you must create, and manage, the VPC endpoints for your VPC. If you choose to create an environment in a shared VPC, you must set this value toCUSTOMER
. In a shared VPC deployment, the environment will remain inPENDING
status until you create the VPC endpoints. If you do not take action to create the endpoints within 72 hours, the status will change toCREATE_FAILED
. You can delete the failed environment and create a new one.Type: String
Valid Values:
CUSTOMER | SERVICE
Required: No
- EnvironmentClass
-
The environment class type. Valid values:
mw1.micro
,mw1.small
,mw1.medium
,mw1.large
,mw1.xlarge
, andmw1.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 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
. 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: 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). For more information, 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
- MaxWebservers
-
The maximum number of web servers that you want to run in your environment. Amazon MWAA scales the number of Apache Airflow web servers up to the number you specify for
MaxWebservers
when you interact with your Apache Airflow environment using Apache Airflow REST API, or the Apache Airflow CLI. For example, in scenarios where your workload requires network calls to the Apache Airflow REST API with a high transaction-per-second (TPS) rate, Amazon MWAA will increase the number of web servers up to the number set inMaxWebserers
. As TPS rates decrease Amazon MWAA disposes of the additional web servers, and scales down to the number set inMinxWebserers
.Valid values: For environments larger than mw1.micro, accepts values from
2
to5
. Defaults to2
for all environment sizes except mw1.micro, which defaults to1
.Type: Integer
Valid Range: Minimum value of 2.
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 inMinWorkers
.Type: Integer
Valid Range: Minimum value of 1.
Required: No
- MinWebservers
-
The minimum number of web servers that you want to run in your environment. Amazon MWAA scales the number of Apache Airflow web servers up to the number you specify for
MaxWebservers
when you interact with your Apache Airflow environment using Apache Airflow REST API, or the Apache Airflow CLI. As the transaction-per-second rate, and the network load, decrease, Amazon MWAA disposes of the additional web servers, and scales down to the number set inMinxWebserers
.Valid values: For environments larger than mw1.micro, accepts values from
2
to5
. Defaults to2
for all environment sizes except mw1.micro, which defaults to1
.Type: Integer
Valid Range: Minimum value of 2.
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 theMinWorkers
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: NetworkConfiguration object
Required: Yes
- 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 theplugins.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 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 environment. Valid values:
-
v2 - For environments larger than mw1.micro, accepts values from
2
to5
. Defaults to2
for all environment sizes except mw1.micro, which defaults to1
. -
v1 - 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
. 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: Yes
- 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
- Tags
-
The key-value tag pairs you want to associate to your environment. For example,
"Environment": "Staging"
. For more information, 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
-
Defines the access mode for the Apache Airflow web server. 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) 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: