Skip to main content

environments

Creates, updates, deletes, gets or lists an environments resource.

Overview

Nameenvironments
TypeResource
Idaws.mwaa.environments

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
airflow_configuration_optionsobjectA 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_versionstringThe 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>)
arnstringThe 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_queuestringThe 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_atstring (date-time)The day and time the environment was created.
dag_s3_pathstringThe 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_servicestringThe 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_managementstringDefines 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_classstringThe 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_arnstringThe 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_keystringThe 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_updateobjectThe status of the last update on the environment.
logging_configurationobjectThe Apache Airflow logs published to CloudWatch Logs.
max_webserversintegerThe 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_workersintegerThe maximum number of workers that run in your environment. For example, 20.
min_webserversintegerThe 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_workersintegerThe minimum number of workers that run in your environment. For example, 2.
namestringThe name of the Amazon MWAA environment. For example, MyMWAAEnvironment. (pattern: <code>[a-zA-Z][0-9a-zA-Z-_]*</code>)
network_configurationobjectDescribes 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_versionstringThe 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_pathstringThe 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_versionstringThe 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_pathstringThe 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>)
schedulersintegerThe number of Apache Airflow schedulers that run in your Amazon MWAA environment.
service_role_arnstringThe 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_arnstringThe 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_versionstringThe 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_pathstringThe 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.
statusstringThe 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)
tagsobjectThe key-value tag pairs associated to your environment. For example, "Environment": "Staging". For more information, refer to Tagging Amazon Web Services resources.
webserver_access_modestringThe 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_urlstringThe 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_servicestringThe 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_startstringThe 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>)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_environmentselectname, regionDescribes an Amazon Managed Workflows for Apache Airflow (MWAA) environment.
list_environmentsselectregionNextToken, MaxResultsLists the Amazon Managed Workflows for Apache Airflow (MWAA) environments.
create_environmentinsertname, region, ExecutionRoleArn, SourceBucketArn, DagS3Path, NetworkConfigurationCreates an Amazon Managed Workflows for Apache Airflow (Amazon MWAA) environment.
update_environmentupdatename, regionUpdates an Amazon Managed Workflows for Apache Airflow (MWAA) environment.
delete_environmentdeletename, regionDeletes an Amazon Managed Workflows for Apache Airflow (Amazon MWAA) environment.
publish_metricsexecenvironment_name, region, MetricDataInternal 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.

NameDatatypeDescription
environment_namestringInternal only. The name of the environment.
namestringThe name of the Amazon MWAA environment. For example, MyMWAAEnvironment.
regionstringAWS region (default: us-east-1)
MaxResultsintegerThe maximum number of results to retrieve per page. For example, 5 environments per page.
NextTokenstringRetrieves the next page of the results.

SELECT examples

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
;

INSERT examples

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
;

UPDATE examples

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

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

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 }}"
}'
;