简体   繁体   English

如何将一个cloudformation参数设置为powershell变量

[英]How to set a cloudformation parameter to a powershell variable

Trying to simply run some powershell in my cloudformation based on a user inpute parameter in cloudformation. 尝试根据cloudformation中的用户输入参数在我的cloudformation中简单地运行一些PowerShell。

This works 这有效

write-host ${CFParameter} >> C:\temp\log.txt

but this does not 但事实并非如此

$PSVariable = ${CFParameter}

write-host $PSVariable >> C:\temp\log.txt

the second one just returns a blank line but the first one returns the correct information 第二个只返回一个空行,但第一个返回正确的信息

If your powershell is being used in userdata and you can use ref function to refer to the parameter. 如果您的powershell正在用户数据中使用,您可以使用ref函数来引用该参数。 I would recommend using cloudkast which is an online cloudformation template generator. 我建议使用cloudkast ,它是一个在线云信息模板生成器。 It makes it easy to generate cloudformation templates. 它可以轻松生成云信息模板。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM