Getting an Aurora Serverless Cluster ARN in CloudFormation (Output)
Asked Answered
S

1

9

I am having trouble retrieving the ARN for a new RDS Aurora Serverless cluster inside a CloudFormation template.

Can someone please advise on what reference the output value should be below?

Resources:
  RDSCluster:
    Type: AWS::RDS::DBCluster
    Properties:
      MasterUsername: someusername
      MasterUserPassword: somepass
      DatabaseName: mydb
      Engine: aurora-postgresql
      EngineMode: serverless
      EngineVersion: '10.7'
      EnableHttpEndpoint: true
      ScalingConfiguration:
        AutoPause: false
        MaxCapacity: 16
        MinCapacity: 2
        SecondsUntilAutoPause: 300

Outputs:
  RDSClusterARN:
    Description: RDS Cluster ARN
    Export:
      Name: RDSCluster
    Value:
      Ref: RDSCluster # Help! What should this value be?

The output I currently get:

    {
        "OutputKey": "RDSClusterARN",
        "OutputValue": "t1-rdscluster-1i771l6x4amfg",
        "Description": "RDS Cluster ARN",
        "ExportName": "RDSCluster"
    },
Sipes answered 13/6, 2020 at 18:22 Comment(0)
N
15

Because of current limitations of the AWS CloudFormation AWS::RDS::DBCluster resource, you have to construct its ARN by hand as follows (see also Working with Amazon Resource Names (ARNs) in Amazon RDS)

!Sub "arn:${AWS::Partition}:rds:${AWS::Region}:${AWS::AccountId}:cluster:${RDSCluster}"
Neighbors answered 13/6, 2020 at 23:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.