【问题标题】:AWS CloudFormation Template format error: Unresolved resource dependencies <s3 bucket> in the Resources block of the templateAWS CloudFormation 模板格式错误:模板的 Resources 块中未解决的资源依赖项 <s3 bucket>
【发布时间】:2021-07-22 07:46:24
【问题描述】:

我要做的就是按照本指南在 AWS https://aws-quickstart.github.io/quickstart-atlassian-jira/ 上启动和运行 Atlassian 服务 (Jira/JSM/Confluence)@

我已经精确地跟踪了所有细节,目前我需要在 cloudformation 上创建堆栈。当我粘贴 .yaml url 时,标题中出现错误,指出资源存在问题。我已经查看了它,但我不确定问题是什么,我们将不胜感激。

Resources:
  VPCStack:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: !Sub
        - https://${QSS3BucketName}.${QSS3Region}.amazonaws.com/${QSS3KeyPrefix}submodules/quickstart-atlassian-services/templates/quickstart-vpc-for-atlassian-services.yaml
        - QSS3Region: !If
            - GovCloudCondition
            - s3-us-gov-west-1
            - s3
      Parameters:
        AccessCIDR: !Ref 'AccessCIDR'
        AvailabilityZones: !Join
          - ','
          - !Ref 'AvailabilityZones'
        ExportPrefix: !Ref 'ExportPrefix'
        KeyPairName: !Ref 'KeyPairName'
        PrivateSubnet1CIDR: !Ref 'PrivateSubnet1CIDR'
        PrivateSubnet2CIDR: !Ref 'PrivateSubnet2CIDR'
        PublicSubnet1CIDR: !Ref 'PublicSubnet1CIDR'
        PublicSubnet2CIDR: !Ref 'PublicSubnet2CIDR'
        VPCCIDR: !Ref 'VPCCIDR'
        BastionHostRequired: !Ref 'BastionHostRequired'

  JiraDCStack:
    DependsOn: VPCStack
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: !Sub
        - https://${QSS3BucketName}.${QSS3Region}.amazonaws.com/${QSS3KeyPrefix}templates/quickstart-jira-dc.template.yaml
        - QSS3Region: !If ["GovCloudCondition", "s3-us-gov-west-1", "s3"]
      Parameters:
        CatalinaOpts: !Ref 'CatalinaOpts'
        CidrBlock: !Ref 'AccessCIDR'
        CloudWatchIntegration: !Ref 'CloudWatchIntegration'
        ClusterNodeInstanceType: !Ref 'ClusterNodeInstanceType'
        ClusterNodeMax: !Ref 'ClusterNodeMax'
        ClusterNodeMin: !Ref 'ClusterNodeMin'
        ClusterNodeVolumeSize: !Ref 'ClusterNodeVolumeSize'
        CustomDnsName: !Ref 'CustomDnsName'
        DBEngine: !Ref DBEngine
        DBEngineVersion: !Ref DBEngineVersion
        DBInstanceClass: !Ref 'DBInstanceClass'
        DBIops: !Ref 'DBIops'
        DBMasterUserPassword: !Ref 'DBMasterUserPassword'
        DBMaxIdle: !Ref 'DBMaxIdle'
        DBMaxWaitMillis: !Ref 'DBMaxWaitMillis'
        DBMinEvictableIdleTimeMillis: !Ref 'DBMinEvictableIdleTimeMillis'
        DBMinIdle: !Ref 'DBMinIdle'
        DBMultiAZ: !Ref 'DBMultiAZ'
        DBPassword: !Ref 'DBPassword'
        DBPoolMaxSize: !Ref 'DBPoolMaxSize'
        DBPoolMinSize: !Ref 'DBPoolMinSize'
        DBRemoveAbandoned: !Ref 'DBRemoveAbandoned'
        DBRemoveAbandonedTimeout: !Ref 'DBRemoveAbandonedTimeout'
        DBStorage: !Ref 'DBStorage'
        DBStorageEncrypted: !Ref 'DBStorageEncrypted'
        DBStorageType: !Ref 'DBStorageType'
        DBTestOnBorrow: !Ref 'DBTestOnBorrow'
        DBTestWhileIdle: !Ref 'DBTestWhileIdle'
        DBTimeBetweenEvictionRunsMillis: !Ref 'DBTimeBetweenEvictionRunsMillis'
        DeploymentAutomationRepository: !Ref 'DeploymentAutomationRepository'
        DeploymentAutomationBranch: !Ref 'DeploymentAutomationBranch'
        DeploymentAutomationKeyName: !Ref 'DeploymentAutomationKeyName'
        DeploymentAutomationPlaybook: !Ref 'DeploymentAutomationPlaybook'
        DeploymentAutomationCustomParams: !Ref 'DeploymentAutomationCustomParams'
        ExportPrefix: !Ref 'ExportPrefix'
        HostedZone: !Ref 'HostedZone'
        InternetFacingLoadBalancer: !Ref 'InternetFacingLoadBalancer'
        JiraProduct: !Ref 'JiraProduct'
        JiraVersion: !Ref 'JiraVersion'
        JvmHeapOverride: !Ref 'JvmHeapOverride'
        KeyPairName: !Ref 'KeyPairName'
        MailEnabled: !Ref 'MailEnabled'
        QSS3BucketName: !Ref 'jira-bucket-aws'
        QSS3KeyPrefix: !Ref 'QSS3KeyPrefix'
        SSLCertificateARN: !Ref 'SSLCertificateARN'
        TomcatAcceptCount: !Ref 'TomcatAcceptCount'
        TomcatContextPath: !Ref 'TomcatContextPath'
        TomcatDefaultConnectorPort: !Ref 'TomcatDefaultConnectorPort'
        TomcatEnableLookups: !Ref 'TomcatEnableLookups'
        TomcatMaxThreads: !Ref 'TomcatMaxThreads'
        TomcatMinSpareThreads: !Ref 'TomcatMinSpareThreads'
        TomcatProtocol: !Ref 'TomcatProtocol'
        TomcatRedirectPort: !Ref 'TomcatRedirectPort'
        BastionHostRequired: !Ref 'BastionHostRequired'

【问题讨论】:

    标签: amazon-web-services amazon-s3 amazon-cloudformation jira


    【解决方案1】:

    您缺少模板参数部分。如果您安装了 AWS CLI,则可以使用 --template-body file://jira-cfn.yaml--template-url https://path.to/your/cfn/template.yaml 运行 aws cloudformation validate-template 以检查模板错误。如果您转到编辑器并在模板中加载/粘贴,您也可以从 CloudFront 控制台运行验证。

    validate the template 运行以下命令会产生此输出(我将您的模板保存为当前工作目录中的 jira-cfn.yaml):

    aws cloudformation validate-template --template-body file://jira-cfn.yaml
    
    An error occurred (ValidationError) when calling the ValidateTemplate operation: Template format error: Unresolved resource dependencies 
    [
    TomcatEnableLookups, 
    DBIops, 
    SSLCertificateARN, 
    QSS3KeyPrefix, 
    JiraProduct, 
    TomcatMinSpareThreads, 
    DBMaxWaitMillis, 
    DBStorageEncrypted, 
    BastionHostRequired, 
    DBTestOnBorrow, 
    DeploymentAutomationPlaybook, 
    MailEnabled, 
    DBMultiAZ, 
    JiraVersion, 
    QSS3BucketName, 
    JvmHeapOverride, 
    DBRemoveAbandoned, 
    DBInstanceClass, 
    DBMasterUserPassword, 
    jira-bucket-aws, 
    CloudWatchIntegration, 
    ClusterNodeInstanceType, 
    DBMinIdle, 
    DBPassword, 
    ClusterNodeMin,
    DeploymentAutomationCustomParams,
    DBStorage,
    TomcatMaxThreads, 
    InternetFacingLoadBalancer, 
    DeploymentAutomationBranch, 
    ClusterNodeMax, 
    DBMaxIdle, 
    TomcatAcceptCount,
    DBStorageType,
    DBEngine,
    AccessCIDR, 
    TomcatDefaultConnectorPort, 
    DBMinEvictableIdleTimeMillis, 
    DeploymentAutomationKeyName, 
    TomcatRedirectPort, 
    DBTestWhileIdle, 
    HostedZone, 
    CatalinaOpts, 
    KeyPairName, 
    CustomDnsName, 
    TomcatContextPath, 
    DBRemoveAbandonedTimeout, 
    ClusterNodeVolumeSize, 
    DBPoolMinSize, 
    DBTimeBetweenEvictionRunsMillis, 
    DBEngineVersion, 
    ExportPrefix, 
    DBPoolMaxSize, 
    DeploymentAutomationRepository, 
    TomcatProtocol
    ] in the Resources block of the template
    

    【讨论】:

    • 如果这是一个愚蠢的问题,我深表歉意,但为什么会抛出错误呢?查看此文档docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/… 它说该部分本身是可选的。为什么在这种情况下需要它?是否有它正在寻找的特定参数?我只是感到困惑,因为我找到的设置指南除了存储桶名称之外不包含任何有关更改模板的信息,但我遇到了很多问题
    • 如果您不使用参数,则它是唯一可选的 - 您的模板确实使用了参数,但它无法找到它们 - 因此出现错误。您可以在模板中定义参数,也可以删除引用并替换为硬编码值。 (我建议定义参数而不是硬编码 - 但两者都可以)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-03-25
    • 2020-10-22
    • 2020-03-30
    • 1970-01-01
    • 1970-01-01
    • 2018-11-14
    • 1970-01-01
    相关资源
    最近更新 更多