admin管理员组文章数量:1414621
I have searched, but this specific case is not coherently documented that I can find.
I just want to spin up a new windows instance in EC2 and copy a file to it. This seems it should be trivial and common. But I must be missing something, I hope something simple aand obvious.
Most examples I see use a "connection" of type "winrm", but it needs a password. What is the password on a newly created instance?
I have searched, but this specific case is not coherently documented that I can find.
I just want to spin up a new windows instance in EC2 and copy a file to it. This seems it should be trivial and common. But I must be missing something, I hope something simple aand obvious.
Most examples I see use a "connection" of type "winrm", but it needs a password. What is the password on a newly created instance?
Share Improve this question edited Feb 22 at 1:47 John Rotenstein 271k28 gold badges447 silver badges531 bronze badges Recognized by AWS Collective asked Feb 20 at 23:14 Daniel WilliamsDaniel Williams 9,33416 gold badges78 silver badges117 bronze badges 2- To obtain the Windows password: Retrieve a Windows administrator password after launching an Amazon EC2 instance | AWS re:Post However, this is not a Terraform-friendly process. – John Rotenstein Commented Feb 21 at 2:35
- Yes, just asking for the password seems to slow down the creation tremendously – Daniel Williams Commented Feb 21 at 22:06
1 Answer
Reset to default 1A common method of performing an operation on an Amazon EC2 instance after it is launched is to Run commands when you launch an EC2 instance with user data input - Amazon Elastic Compute Cloud.
Information passed via the User Data parameter is accessible from the EC2 instance. Amazon-provided AMIs have pre-installed cloud-init
code that checks whether the User Data contains a script. If so, it executes the script the first time that a new instance is launched.
Therefore, you can achieve your goal by:
- Placing the file in an Amazon S3 bucket
- Passing a script via User Data when launching the EC2 instance (make sure the instance is assigned an IAM Role that gives it access to the bucket)
- Program the script to download the file from S3 to the local EC2 disk (using Powershell or the AWS CLI). Note that the script will only execute on the first boot of the instance.
本文标签: amazon web servicesHow to copy a file to a new AWS EC2 Windows instance in TerraformStack Overflow
版权声明:本文标题:amazon web services - How to copy a file to a new AWS EC2 Windows instance in Terraform - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745174171a2646155.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论