Skip to main content

environments

Creates, updates, deletes or gets an environment resource or lists environments in a region

Overview

Nameenvironments
TypeResource
DescriptionResource schema for AWS::MWAA::Environment
Idawscc.mwaa.environments

Fields

NameDatatypeDescription
namestringCustomer-defined identifier for the environment, unique per customer region.
arnstringARN for the MWAA environment.
webserver_urlstringUrl endpoint for the environment's Airflow UI.
execution_role_arnstringIAM role to be used by tasks.
kms_keystringThe identifier of the AWS Key Management Service (AWS KMS) customer master key (CMK) to use for MWAA data encryption.<br />You can specify the CMK using any of the following:<br />Key ID. For example, key/1234abcd-12ab-34cd-56ef-1234567890ab.<br />Key alias. For example, alias/ExampleAlias.<br />Key ARN. For example, arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef.<br />Alias ARN. For example, arn:aws:kms:us-east-1:012345678910:alias/ExampleAlias.<br />AWS authenticates the CMK asynchronously. Therefore, if you specify an ID, alias, or ARN that is not valid, the action can appear to complete, but eventually fails.
airflow_versionstringVersion of airflow to deploy to the environment.
source_bucket_arnstringARN for the AWS S3 bucket to use as the source of DAGs and plugins for the environment.
dag_s3_pathstringRepresents an S3 prefix relative to the root of an S3 bucket.
plugins_s3_object_versionstringRepresents an version ID for an S3 object.
airflow_configuration_optionsobjectKey/value pairs representing Airflow configuration variables.<br />Keys are prefixed by their section:<br />&#91;core&#93;<br />dags&#95;folder=&#123;AIRFLOW&#95;HOME&#125;/dags<br />Would be represented as<br />"core.dags&#95;folder": "&#123;AIRFLOW&#95;HOME&#125;/dags"
environment_classstringTemplated configuration for airflow processes and backing infrastructure.
max_workersintegerMaximum worker compute units.
min_workersintegerMinimum worker compute units.
max_webserversintegerMaximum webserver compute units.
min_webserversintegerMinimum webserver compute units.
schedulersintegerScheduler compute units.
network_configurationobjectConfigures the network resources of the environment.
logging_configurationobjectLogging configuration for the environment.
weekly_maintenance_window_startstringStart time for the weekly maintenance window.
tagsobjectA map of tags for the environment.
webserver_access_modestringChoice for mode of webserver access including over public internet or via private VPC endpoint.
endpoint_managementstringDefines whether the VPC endpoints configured for the environment are created, and managed, by the customer or by Amazon MWAA.
celery_executor_queuestringThe celery executor queue associated with the environment.
database_vpc_endpoint_servicestringThe database VPC endpoint service name.
webserver_vpc_endpoint_servicestringThe webserver VPC endpoint service name, applicable if private webserver access mode selected.
worker_replacement_strategystringThe worker replacement strategy to use when updating the environment. Valid values: &#96;FORCED&#96;, &#96;GRACEFUL&#96;. FORCED means Apache Airflow workers will be stopped and replaced without waiting for tasks to complete before an update. GRACEFUL means Apache Airflow workers will be able to complete running tasks for up to 12 hours during an update before being stopped and replaced.
regionstringAWS region.

For more information, see AWS::MWAA::Environment.

Methods

NameAccessible byRequired Params
create_resourceINSERTName, region
delete_resourceDELETEdata__Identifier, region
update_resourceUPDATEdata__Identifier, data__PatchDocument, region
list_resourcesSELECTregion
get_resourceSELECTdata__Identifier, region

SELECT examples

Gets all properties from an individual environment.

SELECT
region,
name,
arn,
webserver_url,
execution_role_arn,
kms_key,
airflow_version,
source_bucket_arn,
dag_s3_path,
plugins_s3_path,
plugins_s3_object_version,
requirements_s3_path,
requirements_s3_object_version,
startup_script_s3_path,
startup_script_s3_object_version,
airflow_configuration_options,
environment_class,
max_workers,
min_workers,
max_webservers,
min_webservers,
schedulers,
network_configuration,
logging_configuration,
weekly_maintenance_window_start,
tags,
webserver_access_mode,
endpoint_management,
celery_executor_queue,
database_vpc_endpoint_service,
webserver_vpc_endpoint_service,
worker_replacement_strategy
FROM awscc.mwaa.environments
WHERE region = 'us-east-1' AND data__Identifier = '<Name>';

INSERT example

Use the following StackQL query and manifest file to create a new environment resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.mwaa.environments (
Name,
region
)
SELECT
'{{ Name }}',
'{{ region }}';

DELETE example

/*+ delete */
DELETE FROM awscc.mwaa.environments
WHERE data__Identifier = '<Name>'
AND region = 'us-east-1';

Permissions

To operate on the environments resource, the following permissions are required:

Create

airflow:GetEnvironment,
airflow:CreateEnvironment,
airflow:TagResource,
airflow:UntagResource,
iam:PassRole,
iam:ListRoles,
iam:CreatePolicy,
iam:AttachRolePolicy,
iam:CreateRole,
iam:CreateServiceLinkedRole,
s3:GetBucketLocation,
s3:ListAllMyBuckets,
s3:ListBucket,
s3:ListBucketVersions,
s3:CreateBucket,
s3:PutObject,
s3:GetEncryptionConfiguration,
ec2:DescribeSecurityGroups,
ec2:DescribeSubnets,
ec2:DescribeVpcs,
ec2:DescribeRouteTables,
ec2:AuthorizeSecurityGroupIngress,
ec2:CreateSecurityGroup,
ec2:CreateVpcEndpoint,
ec2:CreateNetworkInterface,
kms:CreateGrant,
kms:DescribeKey,
kms:ListAliases

Read

airflow:GetEnvironment

Update

airflow:GetEnvironment,
airflow:UpdateEnvironment,
airflow:TagResource,
airflow:UntagResource,
iam:PassRole,
iam:ListRoles,
iam:AttachRolePolicy,
s3:GetBucketLocation,
s3:ListBucket,
s3:ListBucketVersions,
s3:GetEncryptionConfiguration,
ec2:DescribeSecurityGroups,
ec2:DescribeSubnets,
ec2:DescribeVpcs,
ec2:DescribeRouteTables,
kms:DescribeKey,
kms:ListAliases

Delete

airflow:GetEnvironment,
airflow:DeleteEnvironment

List

airflow:ListEnvironments