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_optionsoptional - map from string to string -
airflow_versionoptional computed - string -
arnoptional computed - string -
created_atoptional computed - string -
dag_s3_pathrequired - string -
environment_classoptional computed - string -
execution_role_arnrequired - string -
idoptional computed - string -
kms_keyoptional - string -
last_updatedoptional computed - list of object-
created_at- string -
error- list of object-
error_code- string -
error_message- string
-
-
status- string
-
-
max_workersoptional computed - number -
min_workersoptional computed - number -
namerequired - string -
plugins_s3_object_versionoptional computed - string -
plugins_s3_pathoptional - string -
requirements_s3_object_versionoptional computed - string -
requirements_s3_pathoptional - string -
service_role_arnoptional computed - string -
source_bucket_arnrequired - string -
statusoptional computed - string -
tagsoptional - map from string to string -
webserver_access_modeoptional computed - string -
webserver_urloptional computed - string -
weekly_maintenance_window_startoptional computed - string -
logging_configurationlist block-
dag_processing_logslist block-
cloud_watch_log_group_arnoptional computed - string -
enabledoptional computed - bool -
log_leveloptional computed - string
-
-
scheduler_logslist block-
cloud_watch_log_group_arnoptional computed - string -
enabledoptional computed - bool -
log_leveloptional computed - string
-
-
task_logslist block-
cloud_watch_log_group_arnoptional computed - string -
enabledoptional computed - bool -
log_leveloptional computed - string
-
-
webserver_logslist block-
cloud_watch_log_group_arnoptional computed - string -
enabledoptional computed - bool -
log_leveloptional computed - string
-
-
worker_logslist block-
cloud_watch_log_group_arnoptional computed - string -
enabledoptional computed - bool -
log_leveloptional computed - string
-
-
-
network_configurationlist block-
security_group_idsrequired - set of string -
subnet_idsrequired - 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
-
Namerequired - String -
ExecutionRoleArnoptional - String -
KmsKeyoptional - String -
AirflowVersionoptional - String -
SourceBucketArnoptional - String -
DagS3Pathoptional - String -
PluginsS3Pathoptional - String -
PluginsS3ObjectVersionoptional - String -
RequirementsS3Pathoptional - String -
RequirementsS3ObjectVersionoptional - String -
AirflowConfigurationOptionsoptional - Json -
EnvironmentClassoptional - String -
MaxWorkersoptional - Integer -
MinWorkersoptional - Integer -
Schedulersoptional - Integer -
NetworkConfigurationoptional - NetworkConfiguration -
LoggingConfigurationoptional - LoggingConfiguration -
WeeklyMaintenanceWindowStartoptional - String -
Tagsoptional - Json -
WebserverAccessModeoptional - String
Explanation in CloudFormation Registry
The
AWS::MWAA::Environmentresource 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.