environments
Creates, updates, deletes, gets or lists an environments resource.
Overview
| Name | environments |
| Type | Resource |
| Id | aws.mwaa.environments |
Fields
The following fields are returned by SELECT queries:
- get_environment
- list_environments
| Name | Datatype | Description |
|---|---|---|
airflow_configuration_options | object | A list of key-value pairs containing the Apache Airflow configuration options attached to your environment. For more information, refer to Apache Airflow configuration options. |
airflow_version | string | The Apache Airflow version on your environment. Valid values: 2.7.2, 2.8.1, 2.9.2, 2.10.1, 2.10.3, 2.11.0, and 3.0.6. (pattern: <code>[0-9a-z.]+</code>) |
arn | string | The Amazon Resource Name (ARN) of the Amazon MWAA environment. (pattern: <code>arn:aws(-[a-z]+)?:airflow:[a-z0-9-]+:\d{12}:environment/\w+.*</code>) |
celery_executor_queue | string | The queue ARN for the environment's Celery Executor. Amazon MWAA uses a Celery Executor to distribute tasks across multiple workers. When you create an environment in a shared VPC, you must provide access to the Celery Executor queue from your VPC. (pattern: <code>arn:aws(-[a-z]+)?:sqs:[a-z0-9-]+:\d{12}:[a-zA-Z_0-9+=,.@-_/]+</code>) |
created_at | string (date-time) | The day and time the environment was created. |
dag_s3_path | string | The relative path to the DAGs folder in your Amazon S3 bucket. For example, s3://mwaa-environment/dags. For more information, refer to Adding or updating DAGs. (pattern: <code>.*</code>) |
database_vpc_endpoint_service | string | The VPC endpoint for the environment's Amazon RDS database. (pattern: <code>([a-z.-]+)?com.amazonaws.vpce.[a-z0-9-]+.[a-zA-Z_0-9+=,.@-_/]+</code>) |
endpoint_management | string | 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 to CUSTOMER, you must create, and manage, the VPC endpoints in your VPC. (CUSTOMER, SERVICE) |
environment_class | string | The environment class type. Valid values: mw1.micro, mw1.small, mw1.medium, mw1.large, mw1.xlarge, and mw1.2xlarge. For more information, refer to Amazon MWAA environment class. |
execution_role_arn | string | The Amazon Resource Name (ARN) of the execution role in IAM that allows MWAA to access Amazon Web Services resources in your environment. For example, arn:aws:iam::123456789:role/my-execution-role. For more information, refer to Amazon MWAA Execution role. (pattern: <code>arn:aws(-[a-z]+)?:iam::\d{12}:role/?[a-zA-Z_0-9+=,.@-_/]+</code>) |
kms_key | string | The KMS encryption key used to encrypt the data in your environment. (pattern: <code>(((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/.+)</code>) |
last_update | object | The status of the last update on the environment. |
logging_configuration | object | The Apache Airflow logs published to CloudWatch Logs. |
max_webservers | integer | 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 in MaxWebserers. As TPS rates decrease Amazon MWAA disposes of the additional web servers, and scales down to the number set in MinxWebserers. Valid values: For environments larger than mw1.micro, accepts values from 2 to 5. Defaults to 2 for all environment sizes except mw1.micro, which defaults to 1. |
max_workers | integer | The maximum number of workers that run in your environment. For example, 20. |
min_webservers | integer | 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 in MinxWebserers. Valid values: For environments larger than mw1.micro, accepts values from 2 to 5. Defaults to 2 for all environment sizes except mw1.micro, which defaults to 1. |
min_workers | integer | The minimum number of workers that run in your environment. For example, 2. |
name | string | The name of the Amazon MWAA environment. For example, MyMWAAEnvironment. (pattern: <code>[a-zA-Z][0-9a-zA-Z-_]*</code>) |
network_configuration | object | Describes the VPC networking components used to secure and enable network traffic between the Amazon Web Services resources for your environment. For more information, refer to About networking on Amazon MWAA. |
plugins_s3_object_version | string | The version of the plugins.zip file in your Amazon S3 bucket. You must specify the version ID that Amazon S3 assigns to the file. 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, refer to Installing custom plugins. |
plugins_s3_path | string | The relative path to the file in your Amazon S3 bucket. For example, s3://mwaa-environment/plugins.zip. For more information, refer to Installing custom plugins. (pattern: <code>.*</code>) |
requirements_s3_object_version | string | The version of the requirements.txt file on your Amazon S3 bucket. You must specify the version ID that Amazon S3 assigns to the file. 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, refer to Installing Python dependencies. |
requirements_s3_path | string | The relative path to the requirements.txt file in your Amazon S3 bucket. For example, s3://mwaa-environment/requirements.txt. For more information, refer to Installing Python dependencies. (pattern: <code>.*</code>) |
schedulers | integer | The number of Apache Airflow schedulers that run in your Amazon MWAA environment. |
service_role_arn | string | The Amazon Resource Name (ARN) for the service-linked role of the environment. For more information, refer to Amazon MWAA Service-linked role. (pattern: <code>arn:aws(-[a-z]+)?:iam::\d{12}:role/?[a-zA-Z_0-9+=,.@-_/]+</code>) |
source_bucket_arn | string | 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, refer to Create an Amazon S3 bucket for Amazon MWAA. (pattern: <code>arn:aws(-[a-z]+)?:s3:::[a-z0-9.-]+</code>) |
startup_script_s3_object_version | string | 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. 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, refer to Using a startup script. |
startup_script_s3_path | string | 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, refer to Using a startup script. |
status | string | The status of the Amazon MWAA environment. Valid values: CREATING - The request to create the environment is in progress. CREATING_SNAPSHOT - The request to update environment details, or upgrade the environment version, is in progress and Amazon MWAA is creating a storage volume snapshot of the Amazon RDS database cluster associated with the environment. A database snapshot is a backup created at a specific point in time. Amazon MWAA uses snapshots to recover environment metadata if the process to update or upgrade an environment fails. CREATE_FAILED - The request to create the environment failed and the environment was not created. AVAILABLE - The request was successful and the environment is ready to use. PENDING - The request was successful, but the process to create the environment is paused until you create the required VPC endpoints in your VPC. After you create the VPC endpoints, the process resumes. UPDATING - The request to update the environment is in progress. ROLLING_BACK - The request to update environment details or upgrade the environment version failed and Amazon MWAA is restoring the environment using the latest storage volume snapshot. DELETING - The request to delete the environment is in progress. DELETED - The request to delete the environment is complete, and the environment has been deleted. UNAVAILABLE - The request failed, but the environment did not return to its previous state and is not stable. UPDATE_FAILED - The request to update the environment failed and the environment was restored to its previous state successfully and is ready to use. MAINTENANCE - The environment is undergoing maintenance. Depending on the type of work Amazon MWAA is performing, your environment might be unavailable during this process. Note that as part of the maintenance work, Amazon MWAA performs with a GRACEFUL workerReplacementStrategy . You can review our troubleshooting guide for a list of common errors and their solutions. For more information, refer to Amazon MWAA troubleshooting. (CREATING, CREATE_FAILED, AVAILABLE, UPDATING, DELETING, DELETED, UNAVAILABLE, UPDATE_FAILED, ROLLING_BACK, CREATING_SNAPSHOT, PENDING, MAINTENANCE) |
tags | object | The key-value tag pairs associated to your environment. For example, "Environment": "Staging". For more information, refer to Tagging Amazon Web Services resources. |
webserver_access_mode | string | The Apache Airflow web server access mode. For more information, refer to Apache Airflow access modes. If set to PUBLIC_AND_PRIVATE, creates both a public network load balancer (NLB) for browser access and a private VPC endpoint (VPCE) for worker-to-webserver communication. This mode is only available for Apache Airflow version 3.2 and later. (PRIVATE_ONLY, PUBLIC_ONLY, PUBLIC_AND_PRIVATE) |
webserver_url | string | The Apache Airflow web server host name for the Amazon MWAA environment. For more information, refer to Accessing the Apache Airflow UI. (pattern: <code>https://.+</code>) |
webserver_vpc_endpoint_service | string | The VPC endpoint for the environment's web server. (pattern: <code>([a-z.-]+)?com.amazonaws.vpce.[a-z0-9-]+.[a-zA-Z_0-9+=,.@-_/]+</code>) |
weekly_maintenance_window_start | string | The day and time of the week in Coordinated Universal Time (UTC) 24-hour standard time that weekly maintenance updates are scheduled. For example: TUE:03:30. (pattern: <code>.(MON|TUE|WED|THU|FRI|SAT|SUN):([01]\d|2[0-3]):(00|30).</code>) |
| Name | Datatype | Description |
|---|---|---|
environment | string | Returns a list of Amazon MWAA environments. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_environment | select | name, region | Describes an Amazon Managed Workflows for Apache Airflow (MWAA) environment. | |
list_environments | select | region | NextToken, MaxResults | Lists the Amazon Managed Workflows for Apache Airflow (MWAA) environments. |
create_environment | insert | name, region, ExecutionRoleArn, SourceBucketArn, DagS3Path, NetworkConfiguration | Creates an Amazon Managed Workflows for Apache Airflow (Amazon MWAA) environment. | |
update_environment | update | name, region | Updates an Amazon Managed Workflows for Apache Airflow (MWAA) environment. | |
delete_environment | delete | name, region | Deletes an Amazon Managed Workflows for Apache Airflow (Amazon MWAA) environment. | |
publish_metrics | exec | environment_name, region, MetricData | Internal only. Publishes environment health metrics to Amazon CloudWatch. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
environment_name | string | Internal only. The name of the environment. |
name | string | The name of the Amazon MWAA environment. For example, MyMWAAEnvironment. |
region | string | AWS region (default: us-east-1) |
MaxResults | integer | The maximum number of results to retrieve per page. For example, 5 environments per page. |
NextToken | string | Retrieves the next page of the results. |
SELECT examples
- get_environment
- list_environments
Describes an Amazon Managed Workflows for Apache Airflow (MWAA) environment.
SELECT
airflow_configuration_options,
airflow_version,
arn,
celery_executor_queue,
created_at,
dag_s3_path,
database_vpc_endpoint_service,
endpoint_management,
environment_class,
execution_role_arn,
kms_key,
last_update,
logging_configuration,
max_webservers,
max_workers,
min_webservers,
min_workers,
name,
network_configuration,
plugins_s3_object_version,
plugins_s3_path,
requirements_s3_object_version,
requirements_s3_path,
schedulers,
service_role_arn,
source_bucket_arn,
startup_script_s3_object_version,
startup_script_s3_path,
status,
tags,
webserver_access_mode,
webserver_url,
webserver_vpc_endpoint_service,
weekly_maintenance_window_start
FROM aws.mwaa.environments
WHERE name = '{{ name }}' -- required
AND region = '{{ region }}' -- required
;
Lists the Amazon Managed Workflows for Apache Airflow (MWAA) environments.
SELECT
environment
FROM aws.mwaa.environments
WHERE region = '{{ region }}' -- required
AND NextToken = '{{ NextToken }}'
AND MaxResults = '{{ MaxResults }}'
;
INSERT examples
- create_environment
- Manifest
Creates an Amazon Managed Workflows for Apache Airflow (Amazon MWAA) environment.
INSERT INTO aws.mwaa.environments (
ExecutionRoleArn,
SourceBucketArn,
DagS3Path,
NetworkConfiguration,
PluginsS3Path,
PluginsS3ObjectVersion,
RequirementsS3Path,
RequirementsS3ObjectVersion,
StartupScriptS3Path,
StartupScriptS3ObjectVersion,
AirflowConfigurationOptions,
EnvironmentClass,
MaxWorkers,
KmsKey,
AirflowVersion,
LoggingConfiguration,
WeeklyMaintenanceWindowStart,
Tags,
WebserverAccessMode,
MinWorkers,
Schedulers,
EndpointManagement,
MinWebservers,
MaxWebservers,
name,
region
)
SELECT
'{{ ExecutionRoleArn }}' /* required */,
'{{ SourceBucketArn }}' /* required */,
'{{ DagS3Path }}' /* required */,
'{{ NetworkConfiguration }}' /* required */,
'{{ PluginsS3Path }}',
'{{ PluginsS3ObjectVersion }}',
'{{ RequirementsS3Path }}',
'{{ RequirementsS3ObjectVersion }}',
'{{ StartupScriptS3Path }}',
'{{ StartupScriptS3ObjectVersion }}',
'{{ AirflowConfigurationOptions }}',
'{{ EnvironmentClass }}',
{{ MaxWorkers }},
'{{ KmsKey }}',
'{{ AirflowVersion }}',
'{{ LoggingConfiguration }}',
'{{ WeeklyMaintenanceWindowStart }}',
'{{ Tags }}',
'{{ WebserverAccessMode }}',
{{ MinWorkers }},
{{ Schedulers }},
'{{ EndpointManagement }}',
{{ MinWebservers }},
{{ MaxWebservers }},
'{{ name }}',
'{{ region }}'
RETURNING
arn
;
# Description fields are for documentation purposes
- name: environments
props:
- name: name
value: "{{ name }}"
description: Required parameter for the environments resource.
- name: region
value: "{{ region }}"
description: Required parameter for the environments resource.
- name: ExecutionRoleArn
value: "{{ ExecutionRoleArn }}"
- name: SourceBucketArn
value: "{{ SourceBucketArn }}"
- name: DagS3Path
value: "{{ DagS3Path }}"
- name: NetworkConfiguration
description: |
Describes the VPC networking components used to secure and enable network traffic between the Amazon Web Services resources for your environment. For more information, refer to About networking on Amazon MWAA.
value:
SubnetIds:
- "{{ SubnetIds }}"
SecurityGroupIds:
- "{{ SecurityGroupIds }}"
- name: PluginsS3Path
value: "{{ PluginsS3Path }}"
- name: PluginsS3ObjectVersion
value: "{{ PluginsS3ObjectVersion }}"
- name: RequirementsS3Path
value: "{{ RequirementsS3Path }}"
- name: RequirementsS3ObjectVersion
value: "{{ RequirementsS3ObjectVersion }}"
- name: StartupScriptS3Path
value: "{{ StartupScriptS3Path }}"
- name: StartupScriptS3ObjectVersion
value: "{{ StartupScriptS3ObjectVersion }}"
- name: AirflowConfigurationOptions
value: "{{ AirflowConfigurationOptions }}"
- name: EnvironmentClass
value: "{{ EnvironmentClass }}"
- name: MaxWorkers
value: {{ MaxWorkers }}
- name: KmsKey
value: "{{ KmsKey }}"
- name: AirflowVersion
value: "{{ AirflowVersion }}"
- name: LoggingConfiguration
description: |
Defines the Apache Airflow log types to send to CloudWatch Logs.
value:
DagProcessingLogs:
Enabled: {{ Enabled }}
LogLevel: "{{ LogLevel }}"
SchedulerLogs:
Enabled: {{ Enabled }}
LogLevel: "{{ LogLevel }}"
WebserverLogs:
Enabled: {{ Enabled }}
LogLevel: "{{ LogLevel }}"
WorkerLogs:
Enabled: {{ Enabled }}
LogLevel: "{{ LogLevel }}"
TaskLogs:
Enabled: {{ Enabled }}
LogLevel: "{{ LogLevel }}"
- name: WeeklyMaintenanceWindowStart
value: "{{ WeeklyMaintenanceWindowStart }}"
- name: Tags
value: "{{ Tags }}"
- name: WebserverAccessMode
value: "{{ WebserverAccessMode }}"
valid_values: ['PRIVATE_ONLY', 'PUBLIC_ONLY', 'PUBLIC_AND_PRIVATE']
- name: MinWorkers
value: {{ MinWorkers }}
- name: Schedulers
value: {{ Schedulers }}
- name: EndpointManagement
value: "{{ EndpointManagement }}"
valid_values: ['CUSTOMER', 'SERVICE']
- name: MinWebservers
value: {{ MinWebservers }}
- name: MaxWebservers
value: {{ MaxWebservers }}
UPDATE examples
- update_environment
Updates an Amazon Managed Workflows for Apache Airflow (MWAA) environment.
UPDATE aws.mwaa.environments
SET
ExecutionRoleArn = '{{ ExecutionRoleArn }}',
AirflowConfigurationOptions = '{{ AirflowConfigurationOptions }}',
AirflowVersion = '{{ AirflowVersion }}',
DagS3Path = '{{ DagS3Path }}',
EnvironmentClass = '{{ EnvironmentClass }}',
LoggingConfiguration = '{{ LoggingConfiguration }}',
MaxWorkers = {{ MaxWorkers }},
MinWorkers = {{ MinWorkers }},
MaxWebservers = {{ MaxWebservers }},
MinWebservers = {{ MinWebservers }},
WorkerReplacementStrategy = '{{ WorkerReplacementStrategy }}',
NetworkConfiguration = '{{ NetworkConfiguration }}',
PluginsS3Path = '{{ PluginsS3Path }}',
PluginsS3ObjectVersion = '{{ PluginsS3ObjectVersion }}',
RequirementsS3Path = '{{ RequirementsS3Path }}',
RequirementsS3ObjectVersion = '{{ RequirementsS3ObjectVersion }}',
Schedulers = {{ Schedulers }},
SourceBucketArn = '{{ SourceBucketArn }}',
StartupScriptS3Path = '{{ StartupScriptS3Path }}',
StartupScriptS3ObjectVersion = '{{ StartupScriptS3ObjectVersion }}',
WebserverAccessMode = '{{ WebserverAccessMode }}',
WeeklyMaintenanceWindowStart = '{{ WeeklyMaintenanceWindowStart }}'
WHERE
name = '{{ name }}' --required
AND region = '{{ region }}' --required
RETURNING
arn;
DELETE examples
- delete_environment
Deletes an Amazon Managed Workflows for Apache Airflow (Amazon MWAA) environment.
DELETE FROM aws.mwaa.environments
WHERE name = '{{ name }}' --required
AND region = '{{ region }}' --required
;
Lifecycle Methods
- publish_metrics
Internal only. Publishes environment health metrics to Amazon CloudWatch.
EXEC aws.mwaa.environments.publish_metrics
@environment_name='{{ environment_name }}' --required,
@region='{{ region }}' --required
@@json=
'{
"MetricData": "{{ MetricData }}"
}'
;