Shared conventions allow teams to collaborate effectively. This rule allows to check that all tag keys match a provided regular expression.

Noncompliant Code Example

With default provided regular expression ^([A-Z]:)([A-Z][A-Za-z]*)$:

AWSTemplateFormatVersion: 2010-09-09
Resources:
  S3Bucket:
    Type: 'AWS::S3::Bucket'
    Properties:
      BucketName: "mybucketname"
      Tags:
        - Key: "anycompany:cost-center" # Noncompliant
          Value: "Accounting"
        - Key: "anycompany:EnvironmentType" # Noncompliant
          Value: "PROD"

 

Compliant Solution

 

AWSTemplateFormatVersion: 2010-09-09
Resources:
  S3Bucket:
    Type: 'AWS::S3::Bucket'
    Properties:
      BucketName: "mybucketname"
      Tags:
        - Key: "Anycompany:CostCenter"
          Value: "Accounting"
        - Key: "Anycompany:EnvironmentType"
          Value: "PROD"

See