awsblog-building-resilient-applications/multi-region/1-infra-stackset/stack-db.yml [44:76]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Resources:
  DBKMSKey:
    Type: AWS::KMS::Key
    Description: KMS Key for Database use
    Properties:
      EnableKeyRotation: true
      PendingWindowInDays: 7
      KeyPolicy:
        Version: 2012-10-17
        Id: key-default-1
        Statement:
          - Sid: Enable IAM User Permissions
            Effect: Allow
            Principal: 
              AWS: !Join
                - ''
                - - 'arn:aws:iam::'
                  - !Ref AWS::AccountId
                  - :root
            Action: kms:*
            Resource: "*"

  DBSecret:
    Condition: PrimaryRegion
    Type: AWS::SecretsManager::Secret
    Properties:
      Description: "Secret for Database Connectivity"
      KmsKeyId: !Ref DBKMSKey
      GenerateSecretString:
        ExcludePunctuation: true
        GenerateStringKey: "password"
        SecretStringTemplate: '{"username":"postgres"}'
      Name: !Sub ${ProjectId}-DBSecret
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



awsblog-building-resilient-applications/single-region/1-infra-stack/stack-db.yml [41:73]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Resources:
  DBKMSKey:
    Type: AWS::KMS::Key
    Description: KMS Key for Database use
    Properties:
      EnableKeyRotation: true
      PendingWindowInDays: 7
      KeyPolicy:
        Version: 2012-10-17
        Id: key-default-1
        Statement:
          - Sid: Enable IAM User Permissions
            Effect: Allow
            Principal: 
              AWS: !Join
                - ''
                - - 'arn:aws:iam::'
                  - !Ref AWS::AccountId
                  - :root
            Action: kms:*
            Resource: "*"

  DBSecret:
    Condition: PrimaryRegion
    Type: AWS::SecretsManager::Secret
    Properties:
      Description: "Secret for Database Connectivity"
      KmsKeyId: !Ref DBKMSKey
      GenerateSecretString:
        ExcludePunctuation: true
        GenerateStringKey: "password"
        SecretStringTemplate: '{"username":"postgres"}'
      Name: !Sub ${ProjectId}-DBSecret
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



