【问题标题】:How to know how many Mount targets to create by Cloudformation如何知道 Cloudformation 要创建多少个 Mount 目标
【发布时间】:2017-12-26 04:14:02
【问题描述】:

我在VPC 中由cloudformationEFS 创建,此VPC 包含很少的EC2 instances

我还需要为每个子网创建挂载目标。

这个cloudformation模板可以在不同的AWS accounts中执行。 如何知道创建了多少Mount targets资源?

我可以在帐户 1 中拥有一个 vpc 和 3 subnets,在帐户 2 中拥有另一个 vpc 和 2 subnets...

如何使模板通用,使其适合每个帐户环境?

 "FileSystem" : {
       "Type" : "AWS::EFS::FileSystem",
       "Properties" : {
         "FileSystemTags" : [
           {
             "Key" : "Name",
             "Value" : "FileSystem"
           }
         ]
       }
     },

     "MountTarget1": {
       "Type": "AWS::EFS::MountTarget",
       "Properties": {
         "FileSystemId": { "Ref": "FileSystem" },
         "SubnetId": { "Ref": "Subnet1" },
         "SecurityGroups": [ { "Ref": "MountTargetSecurityGroup" } ]
       }
     },

     "MountTarget2": {
       "Type": "AWS::EFS::MountTarget",
       "Properties": {
         "FileSystemId": { "Ref": "FileSystem" },
         "SubnetId": { "Ref": "Subnet2" },
         "SecurityGroups": [ { "Ref": "MountTargetSecurityGroup" } ]
       }
     },

【问题讨论】:

    标签: json amazon-web-services amazon-cloudformation amazon-efs mount-point


    【解决方案1】:

    据我了解,您希望能够跨账户重复使用相同的模板,并根据账户所需的子网数量创建适当数量的 MountTargets。

    根据子网的数量(ACL、路由表等),有许多变量和条件适用。您也许可以使用大量条件和参数来完成它,但是模板会变得非常混乱。虽然这不是一个优雅的解决方案。

    更好的方法是使用对流层创建模板。这是 EFS 的示例,可帮助您入门。 https://github.com/cloudtools/troposphere/blob/master/examples/EFS.py

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-12-13
      • 2012-06-25
      • 2011-03-29
      • 1970-01-01
      • 2011-09-27
      • 2017-07-25
      相关资源
      最近更新 更多