使用CloudFormation自动创建linux用户密码
我正在使用CloudFormation创建一台EC2Linux机器,我可以将RDP导入其中。我正在运行所需的安装命令,如下所示:使用CloudFormation自动创建linux用户密码,linux,amazon-web-services,amazon-ec2,command-line-interface,amazon-cloudformation,Linux,Amazon Web Services,Amazon Ec2,Command Line Interface,Amazon Cloudformation,我正在使用CloudFormation创建一台EC2Linux机器,我可以将RDP导入其中。我正在运行所需的安装命令,如下所示: "Metadata" : { "AWS::CloudFormation::Init" : { "config" : { "commands" : {
"Metadata" : {
"AWS::CloudFormation::Init" : {
"config" : {
"commands" : {
"step_a" : {
"command" : "install some stuff..."
},
"step_g" : {
"command" : "sudo yum groupinstall \"Gnome Desktop\" -y"
},
"step_h" : {
"command" : "sudo passwd centos"
},
"step_i" : {
"command" : "configure firewall to allow rdp..."
}
}
}
}
}
如您所见,在步骤h中,我想为默认centos用户设置密码。当需要用户输入时,如何自动返回默认密码值?也许有更好的办法解决这个问题
任何帮助都将不胜感激 有几种方法可以在没有提示的情况下设置用户密码。其中一些可以找到或作为例子 但是,要考虑的潜在问题是如何在模板中提供密码?用纯文本硬编码?这是安全问题。使用
NoEcho
将其作为模板参数传递?这更好,但不可重复,而且容易出错。使用SSM参数存储或AWS机密管理器?这可能是最好的选择,但需要额外的设置