aws-samples/aws-modern-application-workshop

ECS create-service error

Opened this issue · 0 comments

when trying to create ECS through

aws ecs create-service --cli-input-json file://~/environment/aws-modern-application-workshop/module-2/aws-cli/service-definition.json

where input is

{
  "serviceName": "MythicalMysfits-Service",
  "cluster": "MythicalMysfits-Cluster",
  "launchType": "FARGATE",
  "deploymentConfiguration": {
    "maximumPercent": 200,
    "minimumHealthyPercent": 0
  },
  "desiredCount": 1,
  "networkConfiguration": {
    "awsvpcConfiguration": {
      "assignPublicIp": "DISABLED",
      "securityGroups": [
        "sg-0360881183df5e526"
      ],
      "subnets": [
        "subnet-91f9f4129d60c3c6y",
        "subnet-34e51e9257e163837"
      ]
    }
  },
  "taskDefinition": "mythicalmysfitsservice",
  "loadBalancers": [
    {
      "containerName": "MythicalMysfits-Service",
      "containerPort": 8080,
      "targetGroupArn": "arn:aws:elasticloadbalancing:eu-west-1:953499974945:targetgroup/MythicalMysfits-TargetGroup/ac3d880213d8844f"
    }
  ]
}

i got output showing that

"rolloutState": "IN_PROGRESS"

{
    "service": {
        "networkConfiguration": {
            "awsvpcConfiguration": {
                "subnets": [
        "subnet-91f9f4129d60c3c6y",
        "subnet-34e51e9257e163837"
      ], 
                "securityGroups": [
                     "sg-xxx0881183xxxe526"
                ], 
                "assignPublicIp": "DISABLED"
            }
        }, 
        "launchType": "FARGATE", 
        "enableECSManagedTags": false, 
        "loadBalancers": [
            {
                "containerName": "MythicalMysfits-Service", 
                "targetGroupArn": "arn:aws:elasticloadbalancing:eu-west-1:xxx49x9xxxxx:targetgroup/MythicalMysfits-TargetGroup/xx3d880xxxd8844f", 
                "containerPort": 8080
            }
        ], 
        "deploymentController": {
            "type": "ECS"
        }, 
        "desiredCount": 1, 
        "clusterArn": "arn:aws:ecs:eu-west-1:xxx49x9xxxxx:cluster/MythicalMysfits-Cluster", 
        "serviceArn": "arn:aws:ecs:eu-west-1:xxx49x9xxxxx:service/MythicalMysfits-Cluster/MythicalMysfits-Service", 
        "deploymentConfiguration": {
            "deploymentCircuitBreaker": {
                "enable": false, 
                "rollback": false
            }, 
            "maximumPercent": 200, 
            "minimumHealthyPercent": 0
        }, 
        "createdAt": 1669047707.486, 
        "healthCheckGracePeriodSeconds": 0, 
        "schedulingStrategy": "REPLICA", 
        "placementConstraints": [], 
        "deployments": [
            {
                "status": "PRIMARY", 
                "networkConfiguration": {
                    "awsvpcConfiguration": {
                        "subnets": [
                            "subnet-04e51e5639e163837", 
                            "subnet-03f9f4749d60c3c6f"
                        ], 
                        "securityGroups": [
                     "sg-xxx0881183xxxe526"
                        ], 
                        "assignPublicIp": "DISABLED"
                    }
                }, 
                "pendingCount": 0, 
                "launchType": "FARGATE", 
                "rolloutState": "IN_PROGRESS", 
                "rolloutStateReason": "ECS deployment ecs-svc/2600118610767763227 in progress.", 
                "createdAt": 1669047707.486, 
                "desiredCount": 1, 
                "failedTasks": 0, 
                "taskDefinition": "arn:aws:ecs:eu-west-1:xxx49x9xxxxx:task-definition/mythicalmysfitsservice:3", 
                "updatedAt": 1669047707.486, 
                "platformVersion": "1.4.0", 
                "id": "ecs-svc/2600118610767763227", 
                "runningCount": 0
            }
        ], 
        "serviceName": "MythicalMysfits-Service", 
        "events": [], 
        "runningCount": 0, 
        "status": "ACTIVE", 
        "serviceRegistries": [], 
        "pendingCount": 0, 
        "createdBy": "arn:aws:iam::xxx49x9xxxxx:root", 
        "platformVersion": "LATEST", 
        "placementStrategy": [], 
        "propagateTags": "NONE", 
        "roleArn": "arn:aws:iam::xxx49x9xxxxx:role/aws-service-role/ecs.amazonaws.com/AWSServiceRoleForECS", 
        "taskDefinition": "arn:aws:ecs:eu-west-1:xxx49x9xxxxx:task-definition/mythicalmysfitsservice:3",
        "enableExecuteCommand": false
    }
}

when NLB DNS name with some /mysfits, supposed to return a JSON response, as it did when I ran docker image, the page keeps loading. not sure if it's due to the service-definition file,ECS input, or something else. please help.