create_environment
¶
create_environment(
name: EnvironmentName,
execution_role_arn: IamRoleArn,
source_bucket_arn: S3BucketArn,
dag_s3_path: RelativePath,
network_configuration: NetworkConfiguration,
*,
config_overrides: Optional[MWAAClientConfig] = None,
plugins_s3_path: Optional[RelativePath] = None,
plugins_s3_object_version: Optional[S3ObjectVersion] = None,
requirements_s3_path: Optional[RelativePath] = None,
requirements_s3_object_version: Optional[S3ObjectVersion] = None,
startup_script_s3_path: Optional[RelativePath] = None,
startup_script_s3_object_version: Optional[S3ObjectVersion] = None,
airflow_configuration_options: Optional[AirflowConfigurationOptions] = None,
environment_class: Optional[EnvironmentClass] = None,
max_workers: Optional[MaxWorkers] = None,
kms_key: Optional[KmsKey] = None,
airflow_version: Optional[AirflowVersion] = None,
logging_configuration: Optional[LoggingConfigurationInput] = None,
weekly_maintenance_window_start: Optional[WeeklyMaintenanceWindowStart] = None,
tags: Optional[TagMap] = None,
webserver_access_mode: Optional[WebserverAccessMode] = None,
min_workers: Optional[MinWorkers] = None,
schedulers: Optional[Schedulers] = None,
endpoint_management: Optional[EndpointManagement] = None,
min_webservers: Optional[MinWebservers] = None,
max_webservers: Optional[MaxWebservers] = None,
) -> CreateEnvironmentOutput
Creates an Amazon Managed Workflows for Apache Airflow (Amazon MWAA) environment.
Parameters:
-
name(EnvironmentName) –The name of the Amazon MWAA environment. For example,
MyMWAAEnvironment. -
execution_role_arn(IamRoleArn) –The Amazon Resource Name (ARN) of the execution role for your environment. An execution role is an Amazon Web Services Identity and Access Management (IAM) role that grants MWAA permission to access Amazon Web Services services and resources used by your environment. For example,
arn:aws:iam::123456789:role/my-execution-role. For more information, refer to Amazon MWAA Execution role. -
source_bucket_arn(S3BucketArn) –The 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. -
dag_s3_path(RelativePath) –The relative path to the DAGs folder on your Amazon S3 bucket. For example,
dags. For more information, refer to Adding or updating DAGs. -
network_configuration(NetworkConfiguration) –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_path(Optional[RelativePath], default:None) –The relative path to the
plugins.zipfile on your Amazon S3 bucket. For example,plugins.zip. If specified, then theplugins.zipversion is required. For more information, refer to Installing custom plugins. -
plugins_s3_object_version(Optional[S3ObjectVersion], default:None) –The version of the plugins.zip file on your Amazon S3 bucket. You must specify a version each time a plugins.zip file is updated. For more information, refer to How S3 Versioning works.
-
requirements_s3_path(Optional[RelativePath], default:None) –The relative path to the
requirements.txtfile on your Amazon S3 bucket. For example,requirements.txt. If specified, then a version is required. For more information, refer to Installing Python dependencies. -
requirements_s3_object_version(Optional[S3ObjectVersion], default:None) –The version of the
requirements.txtfile on your Amazon S3 bucket. You must specify a version each time a requirements.txt file is updated. For more information, refer to How S3 Versioning works. -
startup_script_s3_path(Optional[RelativePath], default:None) –The 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.
-
startup_script_s3_object_version(Optional[S3ObjectVersion], default:None) –The version of the startup shell script in your Amazon S3 bucket. You must specify the version ID that Amazon S3 assigns to the file every time you update the script.
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+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUoFor more information, refer to Using a startup script.
-
airflow_configuration_options(Optional[AirflowConfigurationOptions], default:None) –A list of key-value pairs containing the Apache Airflow configuration options you want to attach to your environment. For more information, refer to Apache Airflow configuration options.
-
environment_class(Optional[EnvironmentClass], default:None) –The environment class type. Valid values:
mw1.micro,mw1.small,mw1.medium,mw1.large,mw1.xlarge, andmw1.2xlarge. For more information, refer to Amazon MWAA environment class. -
max_workers(Optional[MaxWorkers], default:None) –The maximum number of workers that you want to run in your environment. MWAA scales the number of Apache Airflow workers up to the number you specify in the
MaxWorkersfield. For example,20. When there are no more tasks running, and no more in the queue, MWAA disposes of the extra workers leaving the one worker that is included with your environment, or the number you specify inMinWorkers. -
kms_key(Optional[KmsKey], default:None) –The Amazon Web Services Key Management Service (KMS) key to encrypt the data in your environment. You can use an Amazon Web Services owned CMK, or a Customer managed CMK (advanced). For more information, refer to Create an Amazon MWAA environment.
-
airflow_version(Optional[AirflowVersion], default:None) –The Apache Airflow version for your environment. If no value is specified, it defaults to the latest version. For more information, refer to Apache Airflow versions on Amazon Managed Workflows for Apache Airflow (Amazon MWAA).
Valid values:
2.7.2,2.8.1,2.9.2,2.10.1,2.10.3,2.11.0, and3.0.6. -
logging_configuration(Optional[LoggingConfigurationInput], default:None) –Defines the Apache Airflow logs to send to CloudWatch Logs.
-
weekly_maintenance_window_start(Optional[WeeklyMaintenanceWindowStart], default:None) –The day and time of the week in Coordinated Universal Time (UTC) 24-hour standard time 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. -
tags(Optional[TagMap], default:None) –The key-value tag pairs you want to associate to your environment. For example,
"Environment": "Staging". For more information, refer to Tagging Amazon Web Services resources. -
webserver_access_mode(Optional[WebserverAccessMode], default:None) –Defines the access mode for the Apache Airflow web server. 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. -
min_workers(Optional[MinWorkers], default:None) –The minimum number of workers that you want to run in your environment. MWAA scales the number of Apache Airflow workers up to the number you specify in the
MaxWorkersfield. When there are no more tasks running, and no more in the queue, MWAA disposes of the extra workers leaving the worker count you specify in theMinWorkersfield. For example,2. -
schedulers(Optional[Schedulers], default:None) –The number of Apache Airflow schedulers to run in your environment. Valid values:
-
v2 - For environments larger than mw1.micro, accepts values from
2to5. Defaults to2for all environment sizes except mw1.micro, which defaults to1. -
v1 - Accepts
1.
-
-
endpoint_management(Optional[EndpointManagement], default:None) –Defines 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 toCUSTOMER, you must create, and manage, the VPC endpoints for your VPC. If you choose to create an environment in a shared VPC, you must set this value toCUSTOMER. In a shared VPC deployment, the environment will remain inPENDINGstatus until you create the VPC endpoints. If you do not take action to create the endpoints within 72 hours, the status will change toCREATE_FAILED. You can delete the failed environment and create a new one. -
min_webservers(Optional[MinWebservers], default:None) –The 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
MaxWebserverswhen 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 inMinxWebserers.Valid values: For environments larger than mw1.micro, accepts values from
2to5. Defaults to2for all environment sizes except mw1.micro, which defaults to1. -
max_webservers(Optional[MaxWebservers], default:None) –The 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
MaxWebserverswhen 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 inMaxWebserers. As TPS rates decrease Amazon MWAA disposes of the additional web servers, and scales down to the number set inMinxWebserers.Valid values: For environments larger than mw1.micro, accepts values from
2to5. Defaults to2for all environment sizes except mw1.micro, which defaults to1.
Raises:
-
InternalServerException–InternalServerException: An internal error has occurred.
-
ServiceUnavailableException–ServiceUnavailableException: The service is currently unavailable.
-
ValidationException–ValidationException: The provided input is not valid.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_mwaa/_services/mwaa.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |