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实现把域中某用户添加到本地管理员 请 ...
随机推荐
- set<pair<int,int> > 的运用
In this cafeteria, the N tables are all ordered in one line, where table number 1 is the closest to ...
- ASCII码、HEX、字符、BCD 等等 基础知识思考
每每遇到这些问题就要想个半天,想不明白还不舒服,今天特别把所想整理下避免以后再次进入思想漩涡!!! 计算机存储和传输都是以字节为单位 1 bit = 1 二进制数据 ...
- express与ejs,ejs在Linux上面的路径问题
1.学习使用ejs模板(这个是ejs.js) var express = require('express'); var app = express(); app.set("view eng ...
- Linux安装防火墙
1.安装防火墙 1)yum install iptables(centos) 安装IPtables服务 yum install iptables-services 2)清楚规则iptables -F ...
- Develop Android Game Using Cocos2d-x
0. Environment Windows 7 x64Visual Studio 2013adt-bundle-windows-x86 (http://developer.android.com/s ...
- Go中的系统Signal处理
package main import "fmt" import "os" import "os/signal" import " ...
- How to add a webpart to your website
I have download a webpart that can play media on the website from the internet.Then how to add ...
- 大数据de 2文章
点击可免费试用网易有数 文章来源:网易有数的搭积木原则阐述 ,经作者文雯授权发布 wo ceceshi 相关文章:[推荐] SpringBoot入门(五)--自定义配置
- 实现一个简单版的express
express应该算是早期最优秀的一个node框架了,刚开始学node做后端语言就是用的express,它的cli可以帮我们搭建好项目目录,就像现在的vue,react一样.express本身没有做太 ...
- Python中该使用%还是format来格式化字符串?
%还是format 1.皇城PK Python中格式化字符串目前有两种阵营:%和format,我们应该选择哪种呢? 自从Python2.6引入了format这个格式化字符串的方法之后,我认为%还是fo ...