AWS MWAA Environment
This page shows how to write Terraform and CloudFormation for MWAA Environment and write them securely.
aws_mwaa_environment (Terraform)
The Environment in MWAA can be configured in Terraform with the resource name aws_mwaa_environment
. The following sections describe 3 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_mwaa_environment" "default_environment_class" {
dag_s3_path = "dags/"
execution_role_arn = "arn:aws:iam::123456789012:role/role"
name = "example"
network_configuration {
resource "aws_mwaa_environment" "test_mwaa" {
dag_s3_path = "dags/"
execution_role_arn = aws_iam_role.mwaa_role.arn
name = "test_mwaa"
network_configuration {
resource "aws_mwaa_environment" "mwaa_environment" {
source_bucket_arn = aws_s3_bucket.s3_bucket.arn
dag_s3_path = "dags"
execution_role_arn = aws_iam_role.iam_role.arn
name = var.prefix
max_workers = var.mwaa_max_workers
Parameters
-
airflow_configuration_options
optional - map from string to string -
airflow_version
optional computed - string -
arn
optional computed - string -
created_at
optional computed - string -
dag_s3_path
required - string -
environment_class
optional computed - string -
execution_role_arn
required - string -
id
optional computed - string -
kms_key
optional - string -
last_updated
optional computed - list of object-
created_at
- string -
error
- list of object-
error_code
- string -
error_message
- string
-
-
status
- string
-
-
max_workers
optional computed - number -
min_workers
optional computed - number -
name
required - string -
plugins_s3_object_version
optional computed - string -
plugins_s3_path
optional - string -
requirements_s3_object_version
optional computed - string -
requirements_s3_path
optional - string -
service_role_arn
optional computed - string -
source_bucket_arn
required - string -
status
optional computed - string -
tags
optional - map from string to string -
webserver_access_mode
optional computed - string -
webserver_url
optional computed - string -
weekly_maintenance_window_start
optional computed - string -
logging_configuration
list block-
dag_processing_logs
list block-
cloud_watch_log_group_arn
optional computed - string -
enabled
optional computed - bool -
log_level
optional computed - string
-
-
scheduler_logs
list block-
cloud_watch_log_group_arn
optional computed - string -
enabled
optional computed - bool -
log_level
optional computed - string
-
-
task_logs
list block-
cloud_watch_log_group_arn
optional computed - string -
enabled
optional computed - bool -
log_level
optional computed - string
-
-
webserver_logs
list block-
cloud_watch_log_group_arn
optional computed - string -
enabled
optional computed - bool -
log_level
optional computed - string
-
-
worker_logs
list block-
cloud_watch_log_group_arn
optional computed - string -
enabled
optional computed - bool -
log_level
optional computed - string
-
-
-
network_configuration
list block-
security_group_ids
required - set of string -
subnet_ids
required - set of string
-
Explanation in Terraform Registry
Creates a MWAA Environment resource.
AWS::MWAA::Environment (CloudFormation)
The Environment in MWAA can be configured in CloudFormation with the resource name AWS::MWAA::Environment
. The following sections describe 7 examples of how to use the resource and its parameters.
Example Usage from GitHub
Type: AWS::MWAA::Environment
Properties:
Name: !Ref EnvName
AirflowConfigurationOptions:
webserver.default_ui_timezone: UTC
AirflowVersion: 1.10.12
Type: AWS::MWAA::Environment
Properties:
Name: !Sub "${AWS::StackName}-AirflowEnvironment"
SourceBucketArn: arn:aws:s3:::adastracz-demo-airflow
ExecutionRoleArn: !ImportValue AirflowExecutionRoleArn
DagS3Path: dags
Type: AWS::MWAA::Environment
DependsOn:
- S3CustomResource
- AWSLambdaFunction
- NatGateway1
- NatGateway2
Type: AWS::MWAA::Environment
Properties:
Name: airflow
EnvironmentClass: mw1.small
MaxWorkers: 2
SourceBucketArn: !ImportValue Infra-InfraBucketArn
Type: AWS::MWAA::Environment
Properties:
Name: !Ref EnvironmentName
AirflowConfigurationOptions:
core.default_ui_timezone: "Australia/Melbourne"
logging.logging_level: INFO
"AWS::MWAA::Environment": {
"Type": "AWS::MWAA::Environment",
"Properties": {}
},
"AWS::ApiGatewayV2::Stage": {
"Type": "AWS::ApiGatewayV2::Stage",
"resourceType": "AWS::MWAA::Environment",
"filePath": null
}
]
},
{
Parameters
-
Name
required - String -
ExecutionRoleArn
optional - String -
KmsKey
optional - String -
AirflowVersion
optional - String -
SourceBucketArn
optional - String -
DagS3Path
optional - String -
PluginsS3Path
optional - String -
PluginsS3ObjectVersion
optional - String -
RequirementsS3Path
optional - String -
RequirementsS3ObjectVersion
optional - String -
AirflowConfigurationOptions
optional - Json -
EnvironmentClass
optional - String -
MaxWorkers
optional - Integer -
MinWorkers
optional - Integer -
Schedulers
optional - Integer -
NetworkConfiguration
optional - NetworkConfiguration -
LoggingConfiguration
optional - LoggingConfiguration -
WeeklyMaintenanceWindowStart
optional - String -
Tags
optional - Json -
WebserverAccessMode
optional - String
Explanation in CloudFormation Registry
The
AWS::MWAA::Environment
resource creates an Amazon Managed Workflows for Apache Airflow (MWAA) environment. Topics+ Syntax+ Properties+ Return values+ Examples+ AWS::MWAA::Environment LoggingConfiguration+ AWS::MWAA::Environment ModuleLoggingConfiguration+ AWS::MWAA::Environment NetworkConfiguration
Frequently asked questions
What is AWS MWAA Environment?
AWS MWAA Environment is a resource for MWAA of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS MWAA Environment?
For Terraform, the infracost/infracost, palsahota/elt-infrastructure and claudiobizzotto/aws-mwaa-terraform-private source code examples are useful. See the Terraform Example section for further details.
For CloudFormation, the sajjanbh/aws, AdastraCZ/aws_data_platform and codigube/aws-managed-airflow-template source code examples are useful. See the CloudFormation Example section for further details.