如何引用AWSEBV2LoadBalancer Subnets属性?

问题描述 投票:0回答:1

我正在按照AWS指南将HA Wordpress站点部署到Elastic Beanstalk,其中包括使用eb-php-wordpress扩展。在部署应用程序之前,该过程需要编辑具有已知资源ID的几个配置文件。

特别是,说明指示使用VPC ID和子网ID编辑efs-create.config文件。除其他外,该文件有助于设置AWS :: ElasticBeanstalk :: Environment资源的OptionSettings属性。感谢danimal,我现在知道如何使用Fn::GetAtt将VpcId拉入文件:

option_settings:
  aws:elasticbeanstalk:customoption:
    EFSVolumeName: "EB-EFS-Volume"
    VPCId: { "Fn::GetAtt" : [ "AWSEBSecurityGroup", "VpcId" ] }
  ## Subnet Options
    SubnetA: "subnet-XXXXXXXX"
    SubnetB: "subnet-XXXXXXXX"
    SubnetC: "subnet-XXXXXXXX"
    SubnetD: "subnet-XXXXXXXX"

现在我的障碍是添加这些子网ID。我尝试将相同但稍微扩展的概念应用于AWSEBV2LoadBalancer资源以拉出Subnets数组,但是我收到了一个错误。

代码:

SubnetA: { "Fn::Select" : [ "0", { "Fn::GetAtt" : [ "AWSEBV2LoadBalancer", "Subnets" ] } ] }
SubnetB: { "Fn::Select" : [ "1", { "Fn::GetAtt" : [ "AWSEBV2LoadBalancer", "Subnets" ] } ] }
SubnetC: { "Fn::Select" : [ "2", { "Fn::GetAtt" : [ "AWSEBV2LoadBalancer", "Subnets" ] } ] }
SubnetD: { "Fn::Select" : [ "3", { "Fn::GetAtt" : [ "AWSEBV2LoadBalancer", "Subnets" ] } ] }

错误:

 Service:AmazonCloudFormation, Message:Template error: resource AWSEBV2LoadBalancer does not support attribute type Subnets in Fn::GetAtt

我发现这很奇怪,因为生成的模板在该资源下显示qazxsw poi:

Subnets

我还尝试使用"AWSEBV2LoadBalancer": { "Properties": { "SecurityGroups": [ { "Ref": "AWSEBLoadBalancerSecurityGroup" } ], "Subnets": [ "subnet-0ec0699f08ff45e6e", "subnet-0a4fec611d42b062f", "subnet-09a4c28b8f330c0c3", "subnet-0ea8d69e46ce87afc" ] }, "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer" }, 分配数组,然后使用Subnets: { "Fn::GetAtt" : [ "AWSEBV2LoadBalancer", "Subnets" ]Fn::SelectRef但是它创建了自己的错误:

SubnetA: { "Fn::Select" : [ "0", [ "Ref" : "Subnets" ] ] }

如何提取该数组并将每个元素分配给不同的资源?

amazon-web-services amazon-elastic-beanstalk
1个回答
0
投票

根据文档(每个月),这是不可能的。让我想知道其他人是如何做到的,因为我无法想象我是第一个尝试的人。

© www.soinside.com 2019 - 2024. All rights reserved.