How to check if a parameter exists in Systems Manager from CloudFormation











up vote
0
down vote

favorite












Reading the AWS documentation here, I've found the following statement:




AWS::SSM::Parameter::Name

The name of a Systems Manager parameter key.

Use this parameter when you want to pass the parameter key. For example, you can use this type to validate that the parameter exists.




I wasn't able to make it work, every time I get: Parameter validation failed: parameter value ... for parameter name ... does not exist.



Shoud it be trying to resolve the parameter type AWS::SSM::Parameter::Name? Anyway, I kept searching and found another statement here:




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.




I'm probably not understanding it correctly, so I would like to request an example on how to check if a parameter existis in Systems Manager from CloudFormation?



Use case:



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:



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


And the nested stack:



AWSTemplateFormatVersion: '2010-09-09'
Parameters:
PrivateDomainName:
Type: 'AWS::SSM::Parameter::Value<String>'
Resources:
[sutff...]
Outputs:
TestParameterValue:
# Outputs WHEN it exists: supersecretdomain.company.com
Value: !Ref PrivateDomainName









share|improve this question


















  • 1




    Do you have a parameter in Parameter Store named /company/route53/private? All that's going on here, as far as I know, is that CloudFormation is offering you a mechanism to avoid specifying the parameter store key as a simple string because its value could not be verified. Also, presumably, it allows the CloudFormation console to enumerate the existing Parameter Store keys and offer them to you in a dropdown list when creating the stack.
    – jarmod
    Nov 11 at 22:12










  • No I don't. That's the point I was trying to understand. I thought that using this type (AWS::SSM::Parameter::Name), somehow I could check if it exists before using in my configuration. But after trying a few things I realize that it doesn't resolve the value on compile time, but it does resolve on execution time. And thank you very much for you comment, it made me realize a few use cases of this parameter type, improving the readbility of many places in my configuration.
    – Bruno Novais
    Nov 12 at 20:58















up vote
0
down vote

favorite












Reading the AWS documentation here, I've found the following statement:




AWS::SSM::Parameter::Name

The name of a Systems Manager parameter key.

Use this parameter when you want to pass the parameter key. For example, you can use this type to validate that the parameter exists.




I wasn't able to make it work, every time I get: Parameter validation failed: parameter value ... for parameter name ... does not exist.



Shoud it be trying to resolve the parameter type AWS::SSM::Parameter::Name? Anyway, I kept searching and found another statement here:




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.




I'm probably not understanding it correctly, so I would like to request an example on how to check if a parameter existis in Systems Manager from CloudFormation?



Use case:



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:



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


And the nested stack:



AWSTemplateFormatVersion: '2010-09-09'
Parameters:
PrivateDomainName:
Type: 'AWS::SSM::Parameter::Value<String>'
Resources:
[sutff...]
Outputs:
TestParameterValue:
# Outputs WHEN it exists: supersecretdomain.company.com
Value: !Ref PrivateDomainName









share|improve this question


















  • 1




    Do you have a parameter in Parameter Store named /company/route53/private? All that's going on here, as far as I know, is that CloudFormation is offering you a mechanism to avoid specifying the parameter store key as a simple string because its value could not be verified. Also, presumably, it allows the CloudFormation console to enumerate the existing Parameter Store keys and offer them to you in a dropdown list when creating the stack.
    – jarmod
    Nov 11 at 22:12










  • No I don't. That's the point I was trying to understand. I thought that using this type (AWS::SSM::Parameter::Name), somehow I could check if it exists before using in my configuration. But after trying a few things I realize that it doesn't resolve the value on compile time, but it does resolve on execution time. And thank you very much for you comment, it made me realize a few use cases of this parameter type, improving the readbility of many places in my configuration.
    – Bruno Novais
    Nov 12 at 20:58













up vote
0
down vote

favorite









up vote
0
down vote

favorite











Reading the AWS documentation here, I've found the following statement:




AWS::SSM::Parameter::Name

The name of a Systems Manager parameter key.

Use this parameter when you want to pass the parameter key. For example, you can use this type to validate that the parameter exists.




I wasn't able to make it work, every time I get: Parameter validation failed: parameter value ... for parameter name ... does not exist.



Shoud it be trying to resolve the parameter type AWS::SSM::Parameter::Name? Anyway, I kept searching and found another statement here:




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.




I'm probably not understanding it correctly, so I would like to request an example on how to check if a parameter existis in Systems Manager from CloudFormation?



Use case:



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:



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


And the nested stack:



AWSTemplateFormatVersion: '2010-09-09'
Parameters:
PrivateDomainName:
Type: 'AWS::SSM::Parameter::Value<String>'
Resources:
[sutff...]
Outputs:
TestParameterValue:
# Outputs WHEN it exists: supersecretdomain.company.com
Value: !Ref PrivateDomainName









share|improve this question













Reading the AWS documentation here, I've found the following statement:




AWS::SSM::Parameter::Name

The name of a Systems Manager parameter key.

Use this parameter when you want to pass the parameter key. For example, you can use this type to validate that the parameter exists.




I wasn't able to make it work, every time I get: Parameter validation failed: parameter value ... for parameter name ... does not exist.



Shoud it be trying to resolve the parameter type AWS::SSM::Parameter::Name? Anyway, I kept searching and found another statement here:




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.




I'm probably not understanding it correctly, so I would like to request an example on how to check if a parameter existis in Systems Manager from CloudFormation?



Use case:



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:



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


And the nested stack:



AWSTemplateFormatVersion: '2010-09-09'
Parameters:
PrivateDomainName:
Type: 'AWS::SSM::Parameter::Value<String>'
Resources:
[sutff...]
Outputs:
TestParameterValue:
# Outputs WHEN it exists: supersecretdomain.company.com
Value: !Ref PrivateDomainName






amazon-web-services amazon-cloudformation amazon-systems-manager






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 11 at 21:45









Bruno Novais

416




416








  • 1




    Do you have a parameter in Parameter Store named /company/route53/private? All that's going on here, as far as I know, is that CloudFormation is offering you a mechanism to avoid specifying the parameter store key as a simple string because its value could not be verified. Also, presumably, it allows the CloudFormation console to enumerate the existing Parameter Store keys and offer them to you in a dropdown list when creating the stack.
    – jarmod
    Nov 11 at 22:12










  • No I don't. That's the point I was trying to understand. I thought that using this type (AWS::SSM::Parameter::Name), somehow I could check if it exists before using in my configuration. But after trying a few things I realize that it doesn't resolve the value on compile time, but it does resolve on execution time. And thank you very much for you comment, it made me realize a few use cases of this parameter type, improving the readbility of many places in my configuration.
    – Bruno Novais
    Nov 12 at 20:58














  • 1




    Do you have a parameter in Parameter Store named /company/route53/private? All that's going on here, as far as I know, is that CloudFormation is offering you a mechanism to avoid specifying the parameter store key as a simple string because its value could not be verified. Also, presumably, it allows the CloudFormation console to enumerate the existing Parameter Store keys and offer them to you in a dropdown list when creating the stack.
    – jarmod
    Nov 11 at 22:12










  • No I don't. That's the point I was trying to understand. I thought that using this type (AWS::SSM::Parameter::Name), somehow I could check if it exists before using in my configuration. But after trying a few things I realize that it doesn't resolve the value on compile time, but it does resolve on execution time. And thank you very much for you comment, it made me realize a few use cases of this parameter type, improving the readbility of many places in my configuration.
    – Bruno Novais
    Nov 12 at 20:58








1




1




Do you have a parameter in Parameter Store named /company/route53/private? All that's going on here, as far as I know, is that CloudFormation is offering you a mechanism to avoid specifying the parameter store key as a simple string because its value could not be verified. Also, presumably, it allows the CloudFormation console to enumerate the existing Parameter Store keys and offer them to you in a dropdown list when creating the stack.
– jarmod
Nov 11 at 22:12




Do you have a parameter in Parameter Store named /company/route53/private? All that's going on here, as far as I know, is that CloudFormation is offering you a mechanism to avoid specifying the parameter store key as a simple string because its value could not be verified. Also, presumably, it allows the CloudFormation console to enumerate the existing Parameter Store keys and offer them to you in a dropdown list when creating the stack.
– jarmod
Nov 11 at 22:12












No I don't. That's the point I was trying to understand. I thought that using this type (AWS::SSM::Parameter::Name), somehow I could check if it exists before using in my configuration. But after trying a few things I realize that it doesn't resolve the value on compile time, but it does resolve on execution time. And thank you very much for you comment, it made me realize a few use cases of this parameter type, improving the readbility of many places in my configuration.
– Bruno Novais
Nov 12 at 20:58




No I don't. That's the point I was trying to understand. I thought that using this type (AWS::SSM::Parameter::Name), somehow I could check if it exists before using in my configuration. But after trying a few things I realize that it doesn't resolve the value on compile time, but it does resolve on execution time. And thank you very much for you comment, it made me realize a few use cases of this parameter type, improving the readbility of many places in my configuration.
– Bruno Novais
Nov 12 at 20:58

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53253560%2fhow-to-check-if-a-parameter-exists-in-systems-manager-from-cloudformation%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53253560%2fhow-to-check-if-a-parameter-exists-in-systems-manager-from-cloudformation%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)