AWS Cloud Formation陷入Review_In_Progress

时间:2017-09-24 19:32:37

标签: amazon-cloudformation aws-codepipeline

我正在尝试使用Java-8为AWS使用AWS SAM设置AWS Code Pipeline,如文档中所述

http://docs.aws.amazon.com/lambda/latest/dg/automating-deployment.html (例如,在node.js中)。

然而,我的Staging陷入了CloudFormation Stack很长一段时间都停留在REVIEW_IN_PROGRESS中。有没有办法调试这个问题?

我没有在控制台中看到任何其他事件。有没有具体要检查的东西?

模板如下

$ aws codepipeline get-pipeline --region us-east-1 --name aws-lexbot-facebook-pipeline
{
    "pipeline": {
        "roleArn": "arn:aws:iam::XXXXXXXXXXXX:role/AWS-CodePipeline-Service", 
        "stages": [
            {
                "name": "Source", 
                "actions": [
                    {
                        "inputArtifacts": [], 
                        "name": "Source", 
                        "actionTypeId": {
                            "category": "Source", 
                            "owner": "ThirdParty", 
                            "version": "1", 
                            "provider": "GitHub"
                        }, 
                        "outputArtifacts": [
                            {
                                "name": "MyApp"
                            }
                        ], 
                        "configuration": {
                            "Owner": “xxxxxxx”, 
                            "Repo": "lexbot", 
                            "PollForSourceChanges": "true", 
                            "Branch": "master", 
                            "OAuthToken": "****"
                        }, 
                        "runOrder": 1
                    }
                ]
            }, 
            {
                "name": "Build", 
                "actions": [
                    {
                        "inputArtifacts": [
                            {
                                "name": "MyApp"
                            }
                        ], 
                        "name": "CodeBuild", 
                        "actionTypeId": {
                            "category": "Build", 
                            "owner": "AWS", 
                            "version": "1", 
                            "provider": "CodeBuild"
                        }, 
                        "outputArtifacts": [
                            {
                                "name": "MyAppBuild"
                            }
                        ], 
                        "configuration": {
                            "ProjectName": "aws-lexbot-facebook-codebuild"
                        }, 
                        "runOrder": 1
                    }
                ]
            }, 
            {
                "name": "Staging", 
                "actions": [
                    {
                        "inputArtifacts": [
                            {
                                "name": "MyAppBuild"
                            }
                        ], 
                        "name": "LexBotBetaStack", 
                        "actionTypeId": {
                            "category": "Deploy", 
                            "owner": "AWS", 
                            "version": "1", 
                            "provider": "CloudFormation"
                        }, 
                        "outputArtifacts": [], 
                        "configuration": {
                            "ActionMode": "CHANGE_SET_REPLACE", 
                            "ChangeSetName": "LexBotChangeSet", 
                            "RoleArn": "arn:aws:iam::XXXXXXXXXXX:role/cloudformation-lambda-execution-role", 
                            "Capabilities": "CAPABILITY_IAM", 
                            "StackName": "LexBotBetaStack", 
                            "TemplatePath": "MyAppBuild::SamTemplate.yaml"
                        }, 
                        "runOrder": 1
                    }
                ]
            }
        ], 
        "artifactStore": {
            "type": "S3", 
            "location": “XXXXXX-us-east-1-987802409920"
        }, 
        "name": "aws-lexbot-facebook-pipeline", 
        "version": 1
    }
}

3 个答案:

答案 0 :(得分:8)

概述

在CodePipeline步骤中,您使用的是CHANGE_SET_CREATE操作模式。这会在CloudFormation堆栈上创建更改集,但不会自动执行它。您需要使用CHANGE_SET_EXECUTE执行更改集的第二个操作。或者,您可以将操作的操作模式更改为CREATE_UPDATE,这应该直接更新您的操作。

您可能希望在CodePipeline中使用CHANGE_SET_CREATECHANGE_SET_EXECUTE的一个原因是,您希望在它们之间进行审批。如果您希望自动完成此操作,我建议CREATE_UPDATE

CREATE_UPDATE示例

以下是您的CodePipeline 暂存阶段,但使用CREATE_UPDATE代替CREATE_CHANGE_SET。这将创建一个名为stack的新堆栈,或者如果已存在具有该名称的堆栈,则更新现有堆栈。

{
    "inputArtifacts": [
        {
            "name": "MyAppBuild"
        }
    ], 
    "name": "LexBotBetaStack", 
    "actionTypeId": {
        "category": "Deploy", 
        "owner": "AWS", 
        "version": "1", 
        "provider": "CloudFormation"
    }, 
    "outputArtifacts": [], 
    "configuration": {
        "ActionMode": "CREATE_UPDATE", 
        "ChangeSetName": "LexBotChangeSet", 
        "RoleArn": "arn:aws:iam::XXXXXXXXXXX:role/cloudformation-lambda-execution-role", 
        "Capabilities": "CAPABILITY_IAM", 
        "StackName": "LexBotBetaStack", 
        "TemplatePath": "MyAppBuild::SamTemplate.yaml"
    }, 
    "runOrder": 1
}

CHANGE_SET_CREATE和CHANGE_SET_EXECUTE示例

以下是如何一起使用CHANGE_SET_CREATECHANGE_SET_EXECUTE的示例。它首先在命名堆栈上创建一个更改集,然后执行该更改集。如果您希望在更改集之间执行CodePipeline Approval步骤并执行它,那么它非常有用,因此您可以查看预期的更改。

{
    "inputArtifacts": [
        {
            "name": "MyAppBuild"
        }
    ], 
    "name": "LexBotBetaStackChangeSet", 
    "actionTypeId": {
        "category": "Deploy", 
        "owner": "AWS", 
        "version": "1", 
        "provider": "CloudFormation"
    }, 
    "outputArtifacts": [], 
    "configuration": {
        "ActionMode": "CHANGE_SET_REPLACE", 
        "ChangeSetName": "LexBotChangeSet", 
        "RoleArn": "arn:aws:iam::XXXXXXXXXXX:role/cloudformation-lambda-execution-role", 
        "Capabilities": "CAPABILITY_IAM", 
        "StackName": "LexBotBetaStack", 
        "TemplatePath": "MyAppBuild::SamTemplate.yaml"
    }, 
    "runOrder": 1
},
{
    "name": "LexBotBetaStackExecute", 
    "actionTypeId": {
        "category": "Deploy", 
        "owner": "AWS", 
        "version": "1", 
        "provider": "CloudFormation"
    }, 
    "configuration": {
        "ActionMode": "CHANGE_SET_EXECUTE", 
        "ChangeSetName": "LexBotChangeSet", 
        "StackName": "LexBotBetaStack", 
    }, 
    "runOrder": 2
}

答案 1 :(得分:1)

我去了变更集并点击了执行按钮,现在它显示CREATION_IN_PROGRESS。

答案 2 :(得分:0)

单击更改集并单击“名称”字段中的链接,它向我显示了状态原因中的“模板格式错误:”。凭借这种洞察力,我能够识别并修复错误。