- Newest
- Most votes
- Most comments
Based on the error you're encountering with your MWAA (Managed Workflows for Apache Airflow) CDK deployment, there are several potential issues that could be causing the "Creation failed" error with the "NotStabilized" handler error code.
Here are some suggestions to fix your CDK code:
-
Region-specific subnet configuration: Make sure your VPC has at least two private subnets in different Availability Zones. MWAA requires subnets in at least two AZs for high availability.
-
S3 bucket configuration: Your S3 bucket for DAGs might need additional configuration. Ensure the bucket is in the same region as your MWAA environment.
-
IAM permissions: The execution role might need additional permissions. Consider adding the following managed policies:
AmazonMWAAFullConsoleAccessAmazonMWAASvcRolePolicy
-
Security Group configuration: Your security group allows all outbound traffic, but MWAA might need specific inbound rules for its components to communicate.
-
Airflow version: You're using version 3.0.6, which is valid, but consider using the latest supported version (2.5.1 or 2.6.3) if you continue to have issues.
-
Requirements file: Add a requirements.txt file in your S3 bucket to specify Python dependencies.
Here's a modified version of your code that addresses these potential issues:
# MWAA Execution Role with enhanced permissions mwaa_role = iam.Role( self, "ExecutionRole", role_name=f"{airflow_env_name}-exec-role", assumed_by=iam.CompositePrincipal( iam.ServicePrincipal("airflow.amazonaws.com"), iam.ServicePrincipal("airflow-env.amazonaws.com"), ), path="/service-role/", ) # Add more comprehensive permissions mwaa_role.add_managed_policy( iam.ManagedPolicy.from_aws_managed_policy_name("AmazonMWAASvcRolePolicy") ) mwaa_role.add_managed_policy( iam.ManagedPolicy.from_aws_managed_policy_name("AmazonS3FullAccess") ) # Ensure your VPC has the required endpoints or NAT gateways for MWAA to access AWS services # MWAA Environment with updated configuration mwaa_env = mwaa.CfnEnvironment( self, "AirflowEnvironment", name=airflow_env_name, airflow_version="2.5.1", # Consider using a well-established version environment_class="mw1.small", # Consider using a larger instance for stability execution_role_arn=mwaa_role.role_arn, source_bucket_arn=dags_bucket.bucket_arn, dag_s3_path="dags", network_configuration=network_config, logging_configuration=logging_config, webserver_access_mode="PRIVATE_ONLY", min_workers=1, max_workers=2, )
Additionally, check your CloudWatch logs for more specific error messages that might help identify the exact cause of the failure. The "NotStabilized" error typically means that the resource creation process started but couldn't complete successfully, which could be due to networking issues, permissions problems, or resource constraints.
Sources
Community | How to host a Plotly Dash app on AWS ECS
answered a year ago
Relevant content
asked a year ago
asked a year ago
asked a year ago
asked a year ago
