使用Cloudformation部署ECS堆栈

时间:2018-07-02 13:01:09

标签: amazon-web-services amazon-cloudformation autoscaling amazon-ecs

我正在尝试使用AWS cloudformation创建堆栈, 我一直从自动缩放组收到以下错误“从1中接收到0个SUCCESS信号。无法满足100%MinSuccessfulInstancesPercent要求”。这是因为它无法启动任何ECS实例吗?

这是我模板的相关部分。

"ECSAutoScalingGroup": {
            "Type": "AWS::AutoScaling::AutoScalingGroup",
            "Properties": {
                "VPCZoneIdentifier": [
                    {
                        "Ref": "publicSubnet01"
                    },
                    {
                        "Ref": "publicSubnet02"
                    }
                ],
                "LaunchConfigurationName": {
                    "Ref": "ContainerInstances"
                },
                "MinSize": "1",
                "MaxSize" : "3"
            },
            "CreationPolicy": {
                "ResourceSignal": {
                    "Timeout": "PT15M"
                }
            },
            "UpdatePolicy": {
                "AutoScalingRollingUpdate": {
                    "MinInstancesInService": "1",
                    "MaxBatchSize": "1",
                    "PauseTime": "PT15M",
                    "WaitOnResourceSignals": "true"
                }
            }
        },
        "ContainerInstances": {
            "Type": "AWS::AutoScaling::LaunchConfiguration",
            "Properties": {
            "ImageId": "ami-0ad99772",
            "InstanceType": "t2.micro"
            },
            "Metadata": {
                "AWS::CloudFormation::Init": {
                    "config": {
                        "commands": {
                            "01_add_instance_to_cluster": {
                                "command": {
                                    "Fn::Join": [
                                        "",
                                        [
                                            "#!/bin/bash\n",
                                            "echo ECS_CLUSTER=",
                                            {
                                                "Ref": "ECSCluster"
                                            },
                                            " >> /etc/ecs/ecs.config"
                                        ]
                                    ]
                                }
                            }
                        },
                        "files": {
                            "/etc/cfn/cfn-hup.conf": {
                                "content": {
                                    "Fn::Join": [
                                        "",
                                        [
                                            "[main]\n",
                                            "stack=",
                                            {
                                                "Ref": "AWS::StackId"
                                            },
                                            "\n",
                                            "region=",
                                            {
                                                "Ref": "AWS::Region"
                                            },
                                            "\n"
                                        ]
                                    ]
                                },
                                "mode": "000400",
                                "owner": "root",
                                "group": "root"
                            },
                            "/etc/cfn/hooks.d/cfn-auto-reloader.conf": {
                                "content": {
                                    "Fn::Join": [
                                        "",
                                        [
                                            "[cfn-auto-reloader-hook]\n",
                                            "triggers=post.update\n",
                                            "path=Resources.ContainerInstances.Metadata.AWS::CloudFormation::Init\n",
                                            "action=/opt/aws/bin/cfn-init -v ",
                                            "         --stack ",
                                            {
                                                "Ref": "AWS::StackName"
                                            },
                                            "         --resource ContainerInstances ",
                                            "         --region ",
                                            {
                                                "Ref": "AWS::Region"
                                            },
                                            "\n",
                                            "runas=root\n"
                                        ]
                                    ]
                                }
                            }
                        }
                    }
                }
                }
        },

我是AWS的新手,所以我认为这里缺少一些非常基本的东西。

0 个答案:

没有答案