AWS::MWAA::Environment - AWS CloudFormation

AWS::MWAA::Environment

The AWS::MWAA::Environment resource creates an Amazon Managed Workflows for Apache Airflow (MWAA) environment.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::MWAA::Environment", "Properties" : { "AirflowConfigurationOptions" : AirflowConfigurationOptions, "AirflowVersion" : String, "DagS3Path" : String, "EnvironmentClass" : String, "ExecutionRoleArn" : String, "KmsKey" : String, "LoggingConfiguration" : LoggingConfiguration, "MaxWorkers" : Integer, "Name" : String, "NetworkConfiguration" : NetworkConfiguration, "PluginsS3ObjectVersion" : String, "PluginsS3Path" : String, "RequirementsS3ObjectVersion" : String, "RequirementsS3Path" : String, "SourceBucketArn" : String, "Tags" : TagMap, "WebserverAccessMode" : String, "WeeklyMaintenanceWindowStart" : String } }

Properties

AirflowConfigurationOptions

A list of key-value pairs containing your Apache Airflow configuration options.

Required: No

Type: AirflowConfigurationOptions

Update requires: No interruption

AirflowVersion

The version of Apache Airflow to use for the environment. For example: 1.10.12.

Required: No

Type: String

Update requires: No interruption

DagS3Path

The relative path to the DAGs folder in your Amazon S3 bucket. For example: dags.

Required: No

Type: String

Update requires: No interruption

EnvironmentClass

The environment class name. An environment class determines the size of your metadata database and containers. Valid values: mw1.small, mw1.medium, or mw1.large.

Required: No

Type: String

Update requires: No interruption

ExecutionRoleArn

The ARN of the execution role in IAM that allows MWAA to access AWS resources in your environment.

Required: No

Type: String

Update requires: No interruption

KmsKey

The AWS Key Management Service (KMS) key to encrypt and decrypt the data in your environment. You can use an AWS KMS key managed by MWAA, or a custom KMS key (advanced).

Required: No

Type: String

Update requires: Replacement

LoggingConfiguration

The Apache Airflow logging settings for the environment.

Required: No

Type: LoggingConfiguration

Update requires: No interruption

MaxWorkers

The maximum number of workers to scale up to in the environment. For example: 5.

Required: No

Type: Integer

Update requires: No interruption

Name

The name of your MWAA environment.

Required: Yes

Type: String

Update requires: Replacement

NetworkConfiguration

The VPC networking components for your Amazon MWAA environment.

Required: No

Type: NetworkConfiguration

Update requires: No interruption

PluginsS3ObjectVersion

The version of your plugins.zip file. To learn more, see How S3 Versioning works.

Required: No

Type: String

Update requires: No interruption

PluginsS3Path

The relative path of the plugins.zip file in your Amazon S3 bucket. For example, if the file is at the root of your Amazon S3 bucket, specify plugins.zip.

Required: No

Type: String

Update requires: No interruption

RequirementsS3ObjectVersion

The version of the requirements.txt file. To learn more, see How S3 Versioning works.

Required: No

Type: String

Update requires: No interruption

RequirementsS3Path

The relative path of the requirements.txt file in your Amazon S3 bucket. For example, if the file is at the root of your Amazon S3 bucket, specify requirements.txt.

Required: No

Type: String

Update requires: No interruption

SourceBucketArn

The ARN of the Amazon S3 bucket where your DAG code and supporting files are stored.

Required: No

Type: String

Update requires: No interruption

Tags

A list of key-value pairs for tags you want to attach to your environment.

Required: No

Type: TagMap

Update requires: No interruption

WebserverAccessMode

The mode to access the Apache Airflow web server. A public network allows users to access the Apache Airflow UI over the Internet using their IAM credentials. A private network limits access to Apache Airflow to users within a VPC. Valid values: PRIVATE_ONLY or PUBLIC_ONLY.

Required: No

Type: String

Update requires: No interruption

WeeklyMaintenanceWindowStart

The day and time of the week 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. Supported input includes the following:

  • MON|TUE|WED|THU|FRI|SAT|SUN:([01]\\d|2[0-3]):(00|30)

Required: No

Type: String

Update requires: No interruption

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the environment details.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

Arn

The ARN for the Amazon MWAA environment.

WebserverUrl

The URL of your Apache Airflow UI.

Examples

Create a MWAA environment - JSON

The following example shows how to create a MWAA environment:

JSON

{ "Environment": { "Type": "AWS::MWAA::Environment", "Properties": { "Name": "my-airflow-environment", "AirflowConfigurationOptions": { "logging.logging_level": "INFO", "core.default_timezone": "utc" }, "Tags": { "Environment": "Staging", "Team": "Analytics" }, "NetworkConfiguration": { "SubnetIds": [ "subnet-123456", "subnet-789011" ], "SecurityGroupIds": [ "sg-0101010" ] }, "LoggingConfiguration": { "DagProcessingLogs": { "Enabled": true, "LogLevel": "INFO" }, "SchedulerLogs": { "Enabled": false, "LogLevel": "INFO" }, "TaskLogs": { "Enabled": true, "LogLevel": "INFO" }, "WebserverLogs": { "Enabled": false, "LogLevel": "INFO" }, "WorkerLogs": { "Enabled": false, "LogLevel": "INFO" } }, "SourceBucketArn": "arn:aws:s3:::my-dags-bucket", "ExecutionRoleArn": "arn:aws:iam::012345678900:role/service-role/my-execution-role", "MaxWorkers": 1, "DagS3Path": "dags", "EnvironmentClass": "mw1.small" } } }

Create a MWAA environment - YAML

The following example shows how to create a MWAA environment:

YAML

Environment: Type: AWS::MWAA::Environment Properties: Name: "my-airflow-environment" AirflowConfigurationOptions: { "logging.logging_level" : "INFO", "core.default_timezone" : "utc" } Tags: { "Environment" : "Staging", "Team" : "Analytics" } NetworkConfiguration: SubnetIds: - "subnet-123456" - "subnet-789011" SecurityGroupIds: - "sg-0101010" LoggingConfiguration: DagProcessingLogs: Enabled: true LogLevel: INFO SchedulerLogs: Enabled: false LogLevel: INFO TaskLogs: Enabled: true LogLevel: INFO WebserverLogs: Enabled: false LogLevel: INFO WorkerLogs: Enabled: false LogLevel: INFO SourceBucketArn: "arn:aws:s3:::my-dags-bucket" ExecutionRoleArn: "arn:aws:iam::012345678900:role/service-role/my-execution-role" MaxWorkers: 1 DagS3Path: "dags" EnvironmentClass: mw1.small