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实现把域中某用户添加到本地管理员 请 ...
随机推荐
- 解决 Python2 和 Python3 的共存问题
首先安装两种版本的Python 进入系统属性更改环境变量 将两个版本的安装路径找出. 添加至PATH中,变量之间用分号隔开. D:\Python36\Scripts\;D:\Python36\;D:\ ...
- 微信公众号--JS-SDK
JS-SDK 微信JS-SDK是微信公众平台 面向网页开发者提供的基于微信内的网页开发工具包. 通过使用微信JS-SDK,网页开发者可借助微信高效地使用拍照.选图.语音.位置等手机系统的能力,同时可以 ...
- java 第五章 方法定义及调用
1.方法的定义 什么是方法 方法是完成某个功能的一组语句,通常将常用的功能写成一个方法 方法的定义 [访问控制符] [修饰符] 返回值类型 方法名( (参数类型 形式参数, ,参数类型 形式参数, , ...
- 第三十篇 面向对象的三大特性之继承 supre()
继承 一 .什么是继承? 类的继承跟现实生活中的父.子.孙子.重孙子的继承关系一样,父类又称基类. Python中类的继承分为:单继承 和 多继承. # 定义父类 class ParentClass ...
- 【page.json】配置说明
页面.json用来对本页面的窗口表现进行配置.它只能针对window配置,并且会覆盖 app.json 的 window 中相同的配置项. { /** * 以下是页面顶部导航栏设置 **/ " ...
- 定时爬虫抓当日免费应用:Scrapy + Tkinter + LaunchControl
花了个周末学了下Scrapy,正好一直想买mindnode,于是顺手做了个爬虫,抓取爱范儿每天的限免应用信息. Thinking 大概思路就是使用LaunchControl每天定时(比如早上9点50, ...
- Ubuntu16.04 + CUDA9.0 + cuDNN7.3 + Tensorflow-gpu-1.12 + Jupyter Notebook 深度学习环境配置
目录 一.Ubuntu16.04 LTS系统的安装 二.设置软件源的国内镜像 1. 设置方法 2.关于ubuntu镜像的小知识 三.Nvidia显卡驱动的安装 1. 首先查看显卡型号和推荐的显卡驱动 ...
- 图的同构 (Graph Isomorphism)
整理摘自:https://www.jianshu.com/p/c33b5d1b4cd9 同构是在数学对象之间定义的一类映射,它能揭示出在这些对象的属性或者操作之间存在的关系.若这两个数学结构之间存在同 ...
- Leetcode 675.为高尔夫比赛砍树
为高尔夫比赛砍树 你被请来给一个要举办高尔夫比赛的树林砍树. 树林由一个非负的二维数组表示, 在这个数组中: 0 表示障碍,无法触碰到. 1 表示可以行走的地面. 比1大的数 表示一颗允许走过的树的高 ...
- [PocketFlow]解决在coco上mAP非常低的bug
1.问题 继上次训练挂起的bug后,又遇到了现在评估时AP非常低的bug.具体有多低呢?Pelee论文中提到,用128的batchsize大小在coco数据集上训练70K次迭代后,AP@0.5:0.9 ...