【问题标题】:Whitelist a resource in cloudformation将 cloudformation 中的资源列入白名单
【发布时间】:2022-08-11 17:20:05
【问题描述】:

我正在使用 cloudformation。我正在为 RDS 创建一个安全组并尝试将 EC2 私有 IP 列入白名单。但是创建安全组失败

  TestSecuri:
    Type: AWS::EC2::SecurityGroup
    DependsOn: EC2Instance
    Properties:
      GroupDescription: allow connections from specified CIDR ranges
      SecurityGroupIngress:
      - IpProtocol: tcp
        FromPort: 800
        ToPort: 800
        CidrIp: !GetAtt \"EC2Instance.PrivateIp/32\"

    标签: amazon-web-services amazon-ec2 amazon-cloudformation amazon-rds


    【解决方案1】:

    如果要创建所需的字符串,则需要使用 Fn::Join:

    CidrIp: Fn::Join: [ "/", [ !GetAtt EC2Instance.PrivateIp , "32" ] ]
    

    【讨论】:

      猜你喜欢
      • 2011-01-26
      • 2012-05-15
      • 1970-01-01
      • 2021-12-08
      • 2021-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多