Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fargate CDK Stack Does Not Build Properly and Will Not Deploy Under Amplify #12972

Closed
2 tasks done
maxschnupp opened this issue Jul 19, 2023 · 6 comments
Closed
2 tasks done
Labels
bug Something isn't working custom-cdk Issues related to custom CDK resource functionality duplicate If marked with duplicate, issue will be closed & original will be added for traceability

Comments

@maxschnupp
Copy link

How did you install the Amplify CLI?

via npm

If applicable, what version of Node.js are you using?

20.2.0

Amplify CLI Version

12.1.1

What operating system are you using?

Mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No, we only make changes through the CLI

Describe the bug

We are having a little difficulty integrating fargate into our amplify application.

  • We are able to create a fargate service using cdk in a new cdk project as per this quick-start guide

  • We are trying to add a Fargate service to our amplify backend using a custom cdk stack

  • When we try to build essentially the same code within a custom cdk stack in our amplify application, we note that the cloudformation-template.json file produced is missing the DependsOn properties we would expect to see set for the individual components of the service

  • When we try to deploy with amplify push deployment fails due to an ordering issue in which the target group deployment starts before the load balancer is ready

We get the following error message:


Name: MyWebServerService2FE7341D (AWS::ECS::Service), Event Type: create, Reason: Resource handler returned message: "Invalid request provided: CreateService error: The target group with targetGroupArn arn:aws:elasticloadbalancing:eu-central-1:795147058711:targetgroup/amplif-MyWeb-6FOX36MZKAV3/f37a454e2c3a189f does not have an associated load balancer. (Service: AmazonECS; Status Code: 400; Error Code: InvalidParameterException; Request ID: a314a50c-f877-4234-8c76-2e1182970601; Proxy: null)" (RequestToken: 73f8f220-ab40-fb82-3834-89d4b0bf7cb8, HandlerErrorCode: InvalidRequest), IsCustomResource: true

Expected behavior

Deploys with amplify like the version with CDK CLI and we are able to access the sample PHP application over the world wide web

Reproduction steps

  1. Create a new amplify project

amplify init -y

  1. Add custom stack

amplify add custom

  • for the purposes of this repro we will call this custom stack 'fargateService’
  • select cdk as the tooling
  1. Add an ApplicationLoadBalancedFargateService
  • fargate-service/cdk-stack.ts now looks like this:
import * as cdk from 'aws-cdk-lib';
import * as AmplifyHelpers from '@aws-amplify/cli-extensibility-helper';
import { Construct } from 'constructs';
import * as ecsp from 'aws-cdk-lib/aws-ecs-patterns';
import * as ecs from 'aws-cdk-lib/aws-ecs';

export class cdkStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps, amplifyResourceProps?: AmplifyHelpers.AmplifyResourceProps) {
    super(scope, id, props);
    /* Do not remove - Amplify CLI automatically injects the current deployment environment in this input parameter */
    new cdk.CfnParameter(this, 'env', {
      type: 'String',
      description: 'Current Amplify CLI env name',
    });
   
    new ecsp.ApplicationLoadBalancedFargateService(this, 'MyWebServer', {
      taskImageOptions: {
        image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
      },
      publicLoadBalancer: true
    });
  }
}
  1. build the custom CDK stack

amplify build custom fargateService

  • note that build/fargateService-cloudformation-template.json does not contain any of the ‘DependsOn’ fields that you would have after this step if you followed the CDK quick-start in a CDK project
  1. deploy

amplify push -y

Project Identifier

No response

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@maxschnupp maxschnupp added the pending-triage Issue is pending triage label Jul 19, 2023
@ykethan ykethan added the custom-cdk Issues related to custom CDK resource functionality label Jul 19, 2023
@josefaidt
Copy link
Contributor

Hey @maxschnupp 👋 thanks for raising this! Are you seeing this issue particularly with the L3 construct shown in your snippet? Also please note there is a limitation with custom CDK resources where you are unable to point the image build to a local asset, meaning you are unable to use ecs.ContainerImage.fromAsset().

@josefaidt josefaidt added the pending-response Issue is pending response from the issue author label Jul 19, 2023
@maxschnupp
Copy link
Author

Hi @josefaidt thanks for getting on this so quickly,

Yes we are seeing this issue with the L3 construct as in the snippet, we tried to workaround this by composing multiple constructs together to get the same functionality but we still got the same error ...does not have an associated load balancer. Ultimately we would prefer to be able to use the highest level construct as in the snippet.

We realised that in the cloudformation-template.json files generated by the cdk CLI we see dependencies between the lower level components defined that we do not see in cloud formation files generated by the amplify CLI, maybe this information will be useful for debugging.

We are not using ecs.ContainerImage.fromAsset() so the limitation is not an issue for us.

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Jul 20, 2023
@josefaidt
Copy link
Contributor

Hey @maxschnupp thanks for clarifying! I'm able to reproduce this with the sample custom resource:

🛑 The following resources failed to deploy:
Resource Name: MyWebServerService2FE7341D (AWS::ECS::Service)
Event Type: create
Reason: Resource handler returned message: "Invalid request provided: CreateService error: The target group with targetGroupArn arn:aws:elasticloadbalancing:us-east-1:814763596509:targetgroup/amplif-MyWeb-AVHXZIKH8MQ2/e8c1a2e59159aa89 does not have an associated load balancer. (Service: AmazonECS; Status Code: 400; Error Code: InvalidParameterException; Request ID: a6d45eef-4347-4ad2-9e2d-a5e73d46ecc4; Proxy: null)" (RequestToken: a2afa4fc-c933-40a6-4943-63d18a84673a, HandlerErrorCode: InvalidRequest)

🛑 CFN Deployment failed for custom resources.
Name: MyWebServerService2FE7341D (AWS::ECS::Service), Event Type: create, Reason: Resource handler returned message: "Invalid request provided: CreateService error: The target group with targetGroupArn arn:aws:elasticloadbalancing:us-east-1:814763596509:targetgroup/amplif-MyWeb-AVHXZIKH8MQ2/e8c1a2e59159aa89 does not have an associated load balancer. (Service: AmazonECS; Status Code: 400; Error Code: InvalidParameterException; Request ID: a6d45eef-4347-4ad2-9e2d-a5e73d46ecc4; Proxy: null)" (RequestToken: a2afa4fc-c933-40a6-4943-63d18a84673a, HandlerErrorCode: InvalidRequest), IsCustomResource: true

Which is a bit strange because I also see a load balancer get cleaned up after the resource in error failed

MyWebServerLB3B5FD3AB          AWS::ElasticLoadBalancingV2::… DELETE_COMPLETE
CFN template
{
  "Parameters": {
    "env": {
      "Type": "String",
      "Description": "Current Amplify CLI env name"
    }
  },
  "Resources": {
    "MyWebServerLB3B5FD3AB": {
      "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer",
      "Properties": {
        "LoadBalancerAttributes": [
          {
            "Key": "deletion_protection.enabled",
            "Value": "false"
          }
        ],
        "Scheme": "internet-facing",
        "SecurityGroups": [
          {
            "Fn::GetAtt": [
              "MyWebServerLBSecurityGroup01B285AA",
              "GroupId"
            ]
          }
        ],
        "Subnets": [
          {
            "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99"
          },
          {
            "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2Subnet95FF715A"
          }
        ],
        "Type": "application"
      }
    },
    "MyWebServerLBSecurityGroup01B285AA": {
      "Type": "AWS::EC2::SecurityGroup",
      "Properties": {
        "GroupDescription": "Automatically created Security Group for ELB MyWebServerLB003C2F84",
        "SecurityGroupIngress": [
          {
            "CidrIp": "0.0.0.0/0",
            "Description": "Allow from anyone on port 80",
            "FromPort": 80,
            "IpProtocol": "tcp",
            "ToPort": 80
          }
        ],
        "VpcId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521"
        }
      }
    },
    "MyWebServerLBSecurityGrouptoMyWebServerServiceSecurityGroup408CA18A80531B81C6": {
      "Type": "AWS::EC2::SecurityGroupEgress",
      "Properties": {
        "GroupId": {
          "Fn::GetAtt": [
            "MyWebServerLBSecurityGroup01B285AA",
            "GroupId"
          ]
        },
        "IpProtocol": "tcp",
        "Description": "Load balancer to target",
        "DestinationSecurityGroupId": {
          "Fn::GetAtt": [
            "MyWebServerServiceSecurityGroup6788214A",
            "GroupId"
          ]
        },
        "FromPort": 80,
        "ToPort": 80
      }
    },
    "MyWebServerLBPublicListener03D7C493": {
      "Type": "AWS::ElasticLoadBalancingV2::Listener",
      "Properties": {
        "DefaultActions": [
          {
            "TargetGroupArn": {
              "Ref": "MyWebServerLBPublicListenerECSGroup5AB9F1C3"
            },
            "Type": "forward"
          }
        ],
        "LoadBalancerArn": {
          "Ref": "MyWebServerLB3B5FD3AB"
        },
        "Port": 80,
        "Protocol": "HTTP"
      }
    },
    "MyWebServerLBPublicListenerECSGroup5AB9F1C3": {
      "Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
      "Properties": {
        "Port": 80,
        "Protocol": "HTTP",
        "TargetGroupAttributes": [
          {
            "Key": "stickiness.enabled",
            "Value": "false"
          }
        ],
        "TargetType": "ip",
        "VpcId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521"
        }
      }
    },
    "MyWebServerTaskDefTaskRoleB23C17AA": {
      "Type": "AWS::IAM::Role",
      "Properties": {
        "AssumeRolePolicyDocument": {
          "Statement": [
            {
              "Action": "sts:AssumeRole",
              "Effect": "Allow",
              "Principal": {
                "Service": "ecs-tasks.amazonaws.com"
              }
            }
          ],
          "Version": "2012-10-17"
        }
      }
    },
    "MyWebServerTaskDef4CE825A0": {
      "Type": "AWS::ECS::TaskDefinition",
      "Properties": {
        "ContainerDefinitions": [
          {
            "Essential": true,
            "Image": "amazon/amazon-ecs-sample",
            "LogConfiguration": {
              "LogDriver": "awslogs",
              "Options": {
                "awslogs-group": {
                  "Ref": "MyWebServerTaskDefwebLogGroupC6EE23D4"
                },
                "awslogs-stream-prefix": "MyWebServer",
                "awslogs-region": {
                  "Ref": "AWS::Region"
                }
              }
            },
            "Name": "web",
            "PortMappings": [
              {
                "ContainerPort": 80,
                "Protocol": "tcp"
              }
            ]
          }
        ],
        "Cpu": "256",
        "ExecutionRoleArn": {
          "Fn::GetAtt": [
            "MyWebServerTaskDefExecutionRole3C69E361",
            "Arn"
          ]
        },
        "Family": "MyWebServerTaskDef7B3B7949",
        "Memory": "512",
        "NetworkMode": "awsvpc",
        "RequiresCompatibilities": [
          "FARGATE"
        ],
        "TaskRoleArn": {
          "Fn::GetAtt": [
            "MyWebServerTaskDefTaskRoleB23C17AA",
            "Arn"
          ]
        }
      }
    },
    "MyWebServerTaskDefwebLogGroupC6EE23D4": {
      "Type": "AWS::Logs::LogGroup",
      "UpdateReplacePolicy": "Retain",
      "DeletionPolicy": "Retain"
    },
    "MyWebServerTaskDefExecutionRole3C69E361": {
      "Type": "AWS::IAM::Role",
      "Properties": {
        "AssumeRolePolicyDocument": {
          "Statement": [
            {
              "Action": "sts:AssumeRole",
              "Effect": "Allow",
              "Principal": {
                "Service": "ecs-tasks.amazonaws.com"
              }
            }
          ],
          "Version": "2012-10-17"
        }
      }
    },
    "MyWebServerTaskDefExecutionRoleDefaultPolicy2AEB4329": {
      "Type": "AWS::IAM::Policy",
      "Properties": {
        "PolicyDocument": {
          "Statement": [
            {
              "Action": [
                "logs:CreateLogStream",
                "logs:PutLogEvents"
              ],
              "Effect": "Allow",
              "Resource": {
                "Fn::GetAtt": [
                  "MyWebServerTaskDefwebLogGroupC6EE23D4",
                  "Arn"
                ]
              }
            }
          ],
          "Version": "2012-10-17"
        },
        "PolicyName": "MyWebServerTaskDefExecutionRoleDefaultPolicy2AEB4329",
        "Roles": [
          {
            "Ref": "MyWebServerTaskDefExecutionRole3C69E361"
          }
        ]
      }
    },
    "MyWebServerService2FE7341D": {
      "Type": "AWS::ECS::Service",
      "Properties": {
        "Cluster": {
          "Ref": "EcsDefaultClusterMnL3mNNYN926A5246"
        },
        "DeploymentConfiguration": {
          "MaximumPercent": 200,
          "MinimumHealthyPercent": 50
        },
        "EnableECSManagedTags": false,
        "HealthCheckGracePeriodSeconds": 60,
        "LaunchType": "FARGATE",
        "LoadBalancers": [
          {
            "ContainerName": "web",
            "ContainerPort": 80,
            "TargetGroupArn": {
              "Ref": "MyWebServerLBPublicListenerECSGroup5AB9F1C3"
            }
          }
        ],
        "NetworkConfiguration": {
          "AwsvpcConfiguration": {
            "AssignPublicIp": "DISABLED",
            "SecurityGroups": [
              {
                "Fn::GetAtt": [
                  "MyWebServerServiceSecurityGroup6788214A",
                  "GroupId"
                ]
              }
            ],
            "Subnets": [
              {
                "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1Subnet075EFF4C"
              },
              {
                "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2SubnetE4CEDF73"
              }
            ]
          }
        },
        "TaskDefinition": {
          "Ref": "MyWebServerTaskDef4CE825A0"
        }
      }
    },
    "MyWebServerServiceSecurityGroup6788214A": {
      "Type": "AWS::EC2::SecurityGroup",
      "Properties": {
        "GroupDescription": "Default/MyWebServer/Service/SecurityGroup",
        "SecurityGroupEgress": [
          {
            "CidrIp": "0.0.0.0/0",
            "Description": "Allow all outbound traffic by default",
            "IpProtocol": "-1"
          }
        ],
        "VpcId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521"
        }
      }
    },
    "MyWebServerServiceSecurityGroupfromMyWebServerLBSecurityGroup768CB24C80FFD8DBEB": {
      "Type": "AWS::EC2::SecurityGroupIngress",
      "Properties": {
        "IpProtocol": "tcp",
        "Description": "Load balancer to target",
        "FromPort": 80,
        "GroupId": {
          "Fn::GetAtt": [
            "MyWebServerServiceSecurityGroup6788214A",
            "GroupId"
          ]
        },
        "SourceSecurityGroupId": {
          "Fn::GetAtt": [
            "MyWebServerLBSecurityGroup01B285AA",
            "GroupId"
          ]
        },
        "ToPort": 80
      }
    },
    "EcsDefaultClusterMnL3mNNYN926A5246": {
      "Type": "AWS::ECS::Cluster"
    },
    "EcsDefaultClusterMnL3mNNYNVpc7788A521": {
      "Type": "AWS::EC2::VPC",
      "Properties": {
        "CidrBlock": "10.0.0.0/16",
        "EnableDnsHostnames": true,
        "EnableDnsSupport": true,
        "InstanceTenancy": "default"
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99": {
      "Type": "AWS::EC2::Subnet",
      "Properties": {
        "VpcId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521"
        },
        "AvailabilityZone": {
          "Fn::Select": [
            0,
            {
              "Fn::GetAZs": ""
            }
          ]
        },
        "CidrBlock": "10.0.0.0/18",
        "MapPublicIpOnLaunch": true
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableA1FD6ACC": {
      "Type": "AWS::EC2::RouteTable",
      "Properties": {
        "VpcId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521"
        }
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableAssociation8B583A17": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "Properties": {
        "RouteTableId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableA1FD6ACC"
        },
        "SubnetId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99"
        }
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1DefaultRouteFF4E2178": {
      "Type": "AWS::EC2::Route",
      "Properties": {
        "RouteTableId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableA1FD6ACC"
        },
        "DestinationCidrBlock": "0.0.0.0/0",
        "GatewayId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcIGW9C2C2B8F"
        }
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1EIP8704DB2F": {
      "Type": "AWS::EC2::EIP",
      "Properties": {
        "Domain": "vpc"
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1NATGateway5E3732C1": {
      "Type": "AWS::EC2::NatGateway",
      "Properties": {
        "SubnetId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99"
        },
        "AllocationId": {
          "Fn::GetAtt": [
            "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1EIP8704DB2F",
            "AllocationId"
          ]
        }
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2Subnet95FF715A": {
      "Type": "AWS::EC2::Subnet",
      "Properties": {
        "VpcId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521"
        },
        "AvailabilityZone": {
          "Fn::Select": [
            1,
            {
              "Fn::GetAZs": ""
            }
          ]
        },
        "CidrBlock": "10.0.64.0/18",
        "MapPublicIpOnLaunch": true
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTable263DEAA5": {
      "Type": "AWS::EC2::RouteTable",
      "Properties": {
        "VpcId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521"
        }
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTableAssociation43E5803C": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "Properties": {
        "RouteTableId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTable263DEAA5"
        },
        "SubnetId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2Subnet95FF715A"
        }
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2DefaultRouteB1375520": {
      "Type": "AWS::EC2::Route",
      "Properties": {
        "RouteTableId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTable263DEAA5"
        },
        "DestinationCidrBlock": "0.0.0.0/0",
        "GatewayId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcIGW9C2C2B8F"
        }
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2EIPF0764873": {
      "Type": "AWS::EC2::EIP",
      "Properties": {
        "Domain": "vpc"
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2NATGateway4C855E00": {
      "Type": "AWS::EC2::NatGateway",
      "Properties": {
        "SubnetId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2Subnet95FF715A"
        },
        "AllocationId": {
          "Fn::GetAtt": [
            "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2EIPF0764873",
            "AllocationId"
          ]
        }
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1Subnet075EFF4C": {
      "Type": "AWS::EC2::Subnet",
      "Properties": {
        "VpcId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521"
        },
        "AvailabilityZone": {
          "Fn::Select": [
            0,
            {
              "Fn::GetAZs": ""
            }
          ]
        },
        "CidrBlock": "10.0.128.0/18",
        "MapPublicIpOnLaunch": false
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTable4F1D2E36": {
      "Type": "AWS::EC2::RouteTable",
      "Properties": {
        "VpcId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521"
        }
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTableAssociation34B92275": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "Properties": {
        "RouteTableId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTable4F1D2E36"
        },
        "SubnetId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1Subnet075EFF4C"
        }
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1DefaultRouteA5ADF694": {
      "Type": "AWS::EC2::Route",
      "Properties": {
        "RouteTableId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTable4F1D2E36"
        },
        "DestinationCidrBlock": "0.0.0.0/0",
        "NatGatewayId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1NATGateway5E3732C1"
        }
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2SubnetE4CEDF73": {
      "Type": "AWS::EC2::Subnet",
      "Properties": {
        "VpcId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521"
        },
        "AvailabilityZone": {
          "Fn::Select": [
            1,
            {
              "Fn::GetAZs": ""
            }
          ]
        },
        "CidrBlock": "10.0.192.0/18",
        "MapPublicIpOnLaunch": false
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableDCE46591": {
      "Type": "AWS::EC2::RouteTable",
      "Properties": {
        "VpcId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521"
        }
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableAssociation111C622F": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "Properties": {
        "RouteTableId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableDCE46591"
        },
        "SubnetId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2SubnetE4CEDF73"
        }
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2DefaultRoute20CE2D89": {
      "Type": "AWS::EC2::Route",
      "Properties": {
        "RouteTableId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableDCE46591"
        },
        "DestinationCidrBlock": "0.0.0.0/0",
        "NatGatewayId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2NATGateway4C855E00"
        }
      }
    },
    "EcsDefaultClusterMnL3mNNYNVpcIGW9C2C2B8F": {
      "Type": "AWS::EC2::InternetGateway"
    },
    "EcsDefaultClusterMnL3mNNYNVpcVPCGW2447264E": {
      "Type": "AWS::EC2::VPCGatewayAttachment",
      "Properties": {
        "VpcId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521"
        },
        "InternetGatewayId": {
          "Ref": "EcsDefaultClusterMnL3mNNYNVpcIGW9C2C2B8F"
        }
      }
    }
  },
  "Outputs": {
    "MyWebServerLoadBalancerDNSD1AFCC81": {
      "Value": {
        "Fn::GetAtt": [
          "MyWebServerLB3B5FD3AB",
          "DNSName"
        ]
      }
    },
    "MyWebServerServiceURLB0ED50F6": {
      "Value": {
        "Fn::Join": [
          "",
          [
            "http://",
            {
              "Fn::GetAtt": [
                "MyWebServerLB3B5FD3AB",
                "DNSName"
              ]
            }
          ]
        ]
      }
    }
  },
  "Description": "{\"createdOn\":\"Mac\",\"createdBy\":\"Amplify\",\"createdWith\":\"12.2.0-rc.a3b139fb36.0\",\"stackType\":\"custom-customCDK\",\"metadata\":{}}"
}

As you noted, I do not see any DependsOn in this template. Marking this as "investigating" as we look into this further

@josefaidt josefaidt added the investigating This issue is being investigated label Jul 21, 2023
@josefaidt
Copy link
Contributor

Hey @maxschnupp after further review this is found to be a bug in the way Amplify CLI is synthesizing CloudFormation templates for custom resources. I'll mark this issue accordingly

@josefaidt josefaidt added bug Something isn't working and removed investigating This issue is being investigated pending-triage Issue is pending triage labels Jul 21, 2023
@josefaidt
Copy link
Contributor

Upon further review I will close this as a duplicate report of #12702

@josefaidt josefaidt closed this as not planned Won't fix, can't repro, duplicate, stale Jul 25, 2023
@josefaidt josefaidt added the duplicate If marked with duplicate, issue will be closed & original will be added for traceability label Jul 25, 2023
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working custom-cdk Issues related to custom CDK resource functionality duplicate If marked with duplicate, issue will be closed & original will be added for traceability
Projects
None yet
Development

No branches or pull requests

3 participants