title: How to check if a parameter exists in Systems Manager from CloudFormation
body: <p>Reading the AWS documentation <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html#aws-ssm-parameter-types" rel="nofollow noreferrer">here</a>, I've found the following statement:</p>
  
  <blockquote>
    <p>AWS::SSM::Parameter::Name<br>
    The name of a Systems Manager parameter key.<br>
    Use this parameter when you want to pass the parameter key. For example, you can use this type to validate that the parameter exists.</p>
  </blockquote>
  
  <p>I wasn't able to make it work, every time I get: <strong><em>Parameter validation failed: parameter value ... for parameter name ... does not exist.</em></strong></p>
  
  <p>Shoud it be trying to resolve the parameter type <em>AWS::SSM::Parameter::Name</em>? Anyway, I kept searching and found another statement <a href="https://aws.amazon.com/blogs/mt/integrating-aws-cloudformation-with-aws-systems-manager-parameter-store/" rel="nofollow noreferrer">here</a>:</p>
  
  <blockquote>
    <p>The first one in the list is used to pass the name of the parameter key as-is. CloudFormation will not fetch the value stored against it. For example, you can use this type to validate that the parameter exists in Parameter Store.</p>
  </blockquote>
  
  <p>I'm probably not understanding it correctly, so I would like to request an example on <strong>how to check if a parameter existis in Systems Manager from CloudFormation?</strong></p>
  
  <p>Use case:</p>
  
  <p>My main region has all parameters stored on Systems Manager, but my second one (redundancy) has only a few. Consider as example not creating the Zone/RecorSet twice in each region. For that I use a condition, as shown bellow:</p>
  
  <pre><code>AWSTemplateFormatVersion: '2010-09-09'
  Parameters:
    MainRegion:
      Type: String
      Default: 'us-east-1'
    PrivateFullyQualifiedDomainName:
      Type: 'AWS::SSM::Parameter::Name'
      Default: '/company/route53/private'
  Conditions:
    CreateUniqueResources: !Equals [ !Ref 'AWS::Region', !Ref MainRegion ]
  Resources:
    Route53Stack:
      Type: 'AWS::CloudFormation::Stack'
      Condition: CreateUniqueResources
      Properties:
        TemplateURL: [some s3 bucket]
        Parameters:
          PrivateDomainName: !Ref PrivateFullyQualifiedDomainName
  Outputs:
    TestParameterName:
      # Outputs: /company/route53/private
      Value: !Ref PrivateFullyQualifiedDomainName
  </code></pre>
  
  <p>And the nested stack:</p>
  
  <pre><code>AWSTemplateFormatVersion: '2010-09-09'
  Parameters:
    PrivateDomainName:
      Type: 'AWS::SSM::Parameter::Value&lt;String&gt;'
  Resources:
    [sutff...]
  Outputs:
    TestParameterValue:
      # Outputs WHEN it exists: supersecretdomain.company.com
      Value: !Ref PrivateDomainName
  </code></pre>