deploy a ec2 and join into domain with terraform
Below is the example to convert the ps script into userdata for terraform to create instance and auto join domain. But to make it work, we need to create a new DHCP options set for related VPC and have the domain-name= domain.com and domain-name-servers = IP-of-the-domain-controllers . so default DNS servers for new instance in that VPC will be domain controllers.
resource "aws_instance" "example" {
ami = "${lookup(var.amis, var.region)}"
instance_type = "t2.micro"
subnet_id = "subnet-fe179a00"
vpc_security_group_ids = ["sg-b93c9100"]
key_name = "newkey"
provisioner "local-exec" {
command = "echo ${aws_instance.example.public_ip} > ip_address.txt"
}
user_data = "<powershell>$Domain = 'domain.com'; $Username = 'domain\\admin' ; $Password = 'xxxxxxxx' ; $pwd = $Password | ConvertTo-SecureString -asPlainText -Force ; $credential = New-Object System.Management.Automation.PSCredential($UserName,$pwd) ;Add-Computer -DomainName $Domain -Credential $credential -Restart</powershell>"
}
deploy a ec2 and join into domain with terraform的更多相关文章
- Join to domain powershell script
Join to domain powershell script $username = "domain\admin" $Password = "xxxxxxxx&quo ...
- How to join a Ubuntu to Windows Domain
My testing environment: Windows Server 2012 R2 Essentials: With AD and standalone DC in one single b ...
- [CENTOS7] 加入Windows域
This following article is a snapshot from: https://www.rootusers.com/how-to-join-centos-linux-to-an- ...
- python getopt.getopt 不能精确匹配的问题
代码:opts,argv = getopt.getopt(sys.argv[1:],('u:'),['ad','join','passwd=','domain=','dip=','test','ip= ...
- git泄漏原理
之前做过git的加固 但是这东西还是没办法避免的 之前看了乌云的提交的git泄漏,但是都没有详细的原理,去了lijiejie的博客(字太难打了,大师傅别打我 哈哈) 如果一个网站存在git泄漏,git ...
- IIS Shared Configuration
Introduction The Internet changes the ways in which companies handle their day-to-day business and h ...
- 【转载】Shared Configuration
Introduction The Internet changes the ways in which companies handle their day-to-day business and h ...
- Enabling Active Directory Authentication for VMWare Server running on Linux《转载》
Enabling Active Directory Authentication for VMWare Server running on Linux Version 0.2 - Adam Breid ...
- .net程序实现给机器加域,添加域账号到本地管理员
以下.net代码中共有两个方法. AddComputerToDomain实现给把本计算机添加到某个域中 AddDomainUserToLocalAdminGroup实现把域中某用户添加到本地管理员 请 ...
随机推荐
- java8lambda表达式初识
一.函数式接口 只有一个 抽象方法 的 接口 叫函数式接口 /** * @auther hhh * @date 2018/12/24 22:20 * @description 函数式接口:只有 一个 ...
- Apache Tomcat 整合
Infi-chu: http://www.cnblogs.com/Infi-chu/ 一.Apache+Tomcat整合是什么: 1.Apache默认访问端口是80,Tomcat默认访问端口是8080 ...
- java入门---windows和Linux,UNIX,Solaris,FreeBSD下开发环境配置
首先来看Windows下的操作.我们需要下载java开发工具包JDK.下载地址:http://www.oracle.com/technetwork/java/javase/downloads/ ...
- js字符串操作函数
js字符串函数 JS自带函数 concat 将两个或多个字符的文本组合起来,返回一个新的字符串. var a = "hello"; var b = ",world&quo ...
- Mac OS下搭建Hadoop + Spark集群
首先注意版本兼容问题!!!本文采用的是Scala 2.11.8 + Hadoop 2.7.5 + Spark 2.2.0 请在下载Spark时务必看清对应的Scala和Hadoop版本! 一.配置JD ...
- 通过数据库恢复SharePoint网站
SharePoint网站一般包含很多个数据库,最主要的有3个,分别是SharePoint_Admin_Content(管理中心数据库),SharePoint_Config(配置数据库)和 ...
- html5学得好不好,看掌握多少标签
html5学得好不好,看掌握多少标签 已回复 会员ID:wi701329 保密 62岁 时间:2016-06-28 06:52:49 html5你了解了多少?如果你还是入门阶段的话,或者还是一知半解的 ...
- Jmeter学习(三)
Apache JMeter是Apache组织开发的基于Java的压力测试工具.用于对软件做压力测试,它最初被设计用于Web应用测试,但后来扩展到其他测试.(来自百度) jmeter的特点: 开源免费. ...
- 「暑期训练」「基础DP」 Piggy-Bank (HDU-1114)
题意与分析 完全背包问题. 算法背包九讲里面都有提到过,我自己再说下对完全背包的理解. 为什么01背包中遍历状态从VV到00?考虑一下基本方程$dp[i][j]=max(dp[i-1][j-w[i]] ...
- Ubuntu下使用Git_3
这里是我举得小白阶段比较困难的地方了, 当在我们向远程数据库推送数据之前,有其他用户向远程数据库推送的相同的文件的时候,服务器会拒绝我们的推送,这个时候就需要我们来整合这两个文件 如图说是,现在显示的 ...