代码之家  ›  专栏  ›  技术社区  ›  Max Allan

Cloudformation:访问stack文件夹中的其他资源,文件夹在哪里?

  •  0
  • Max Allan  · 技术社区  · 6 年前

    我在git中检查它们,创建一个s3bucket和文件夹,并在主模板文件中指向Cloudformation。

    我希望它从“当前”bucket/文件夹导入嵌套堆栈(和其他一些资源)。

    或者我需要在用户创建堆栈时向他们请求s3url吗?因此,首先在S3中选择文件,然后必须复制URL按next并粘贴URL。似乎必须有一个更干净的解决方案!

    2 回复  |  直到 6 年前
        1
  •  2
  •   Tamir Rosenberg    6 年前

    对于您的解决方案,您只需使用通过“Parameter”属性传递到嵌套堆栈的s3url。请在此处查看: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html#cfn-cloudformation-stack-parameters

    以及其他注意事项:

    1. 在您提供的s3url中,您只是映射到一个特定的区域端点。另一个URL也是有效的,有更多的选项可以提供s3url。根据文件: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#create-bucket-intro

    2. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html#aws-resource-cloudformation-stack-syntax

        2
  •  0
  •   Tamir Rosenberg    6 年前

    在“AWS::CloudFormation::Stack”资源中,应该使用“TemplateURL”属性。

    例如:

    {
      "Type" : "AWS::CloudFormation::Stack",
      "Properties" : {
        "NotificationARNs" : [ String, ... ],
        "Parameters" : { AWS CloudFormation Stack Parameters },
        "Tags" : [ Resource Tag, ... ],
        "TemplateURL" : String,
        "TimeoutInMinutes" : Integer
      }
    }
    

    “模板URL”- 指定要作为资源创建的堆栈的模板的URL。模板文件可以使用任何扩展名,例如.json、.yaml、.Template或.txt。模板必须存储在Amazon S3存储桶中,因此URL必须具有以下格式: https://s3.amazonaws.com/.../TemplateName.extension

    有关详细信息: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html#cfn-cloudformation-stack-templateurl

    如果需要更多的帮助,请告诉我。