簡體   English   中英

如何在 CloudFormation 模板中將字符串轉換為大寫

[英]How to convert string to uppercase in CloudFormation template

我的 CloudFormation 模板中有以下部分

 PublicSubnetA:
    Type: AWS::EC2::Subnet
    Properties:
      VpcId: !Ref VPC
      CidrBlock: 10.1.10.0/24
      AvailabilityZone: !Select [ 0, !GetAZs ]    # Get the first AZ in the list        
      Tags:
      - Key: Name
        Value: !Sub
          - ${AWS::StackName}-PUB-${SUFFIX}
          - SUFFIX: !Select [ 0, !GetAZs ]

我需要 SUFFIX 為大寫,我該怎么做?

您可以使用調用宏的轉換內部函數來完成。 有人已經寫了一堆關於字符串操作的宏,所以如果你部署了它們,你就可以使用它們而無需額外的編碼。

https://github.com/awslabs/aws-cloudformation-templates/tree/master/aws/services/CloudFormation/MacrosExamples/StringFunctions

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM