This guide describes how to configure Windows EC2 Instance to be good for run as Agent for EC2 Fleet Jenkins Plugin. At the end of this guide you will get AWS EC2 AMI (Image) which could be used for Auto Scaling Group or EC2 Spot Fleet to run Windows agents.
Big thanks to @Michenux for help to find all details
Note Before this, please consider to use Windows OpenSSH https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/doc/CONFIGURE.md#launch-windows-slaves-using-microsoft-openssh
Note This guide uses Windows DCOM technology (not open ssh) it doesn't work over NAT, so Jenkins Master EC2 Instance should be placed in same VPC as Agents managed by EC2 Fleet Plugin.
- Note Windows Password for this guide
- Login to Windows
- Goto
Local Users and Groups
- Click
Users
- Create New with name
jenkins
- Set password and note it
- Set
Password never expires
- Set
User cannot change password
- Unset
User must change password at next logon
- Goto user properties, find
Member Of
addAdministrators
group
-
Run
regedit
-
Set
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled
to1
-
Goto
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
-
Create/Modify
DWORD-32
with nameLocalAccountTokenFilterPolicy
value1
-
Goto
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa
-
Create/Modify
DWORD-32
with nameLMCompatibilityLevel
value2
- send NTLM authentication only
-
Find key
76A64158-CB41-11D1-8B02-00600806D9B6
- it’s in
HKEY_CLASSES_ROOT\CLSID
- it’s in
-
Right click and select
Permissions
-
Change owner to
Administrators
select apply to children -
Add
Full Control
toAdministrators
make sure to apply for children as well -
Change owner back to
NT Service\TrustedInstaller
select apply to children -
Run service
Remote Registry
-
Restart Windows
- Run as
PowerShell
as Administrator - Run
Enable-WindowsOptionalFeature -Online -FeatureName smb1protocol
- Run
Set-SmbServerConfiguration -EnableSMB1Protocol $true
- Search for
Windows Defender Firewall
- Click
Advanced settings
- Goto
Inbound Rules
- Add
Remote Assistance TCP 135
- Add
File and Printer Sharing (NB-Name-In) UDP 137
- Add
File and Printer Sharing (NB-Datagram-In) UDP 138
- Add
File and Printer Sharing (NB-Session-In) TCP 139
- Add
File and Printer Sharing (SMB-In) TCP 445
- Add
jenkins-master 40000-60000 TCP 40000-60000
- Add
Administrator at Distance COM+ (DCOM) TCP C:\WINDOWS\System32\dllhost.exe
- For all created goto
Properties -> Advanced
and setAllow edge traversal
- Open
PowerShell
- Install Scoop
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
scoop install git-with-openssh
scoop bucket add java
scoop install ojdkbuild8-full
- Goto
Control Panel\System and Security\System
- Goto
Advanced System Settings
- Goto
Environment Variables...
- Add Java Path (
C:\Users\jenkins\scoop\apps\ojdkbuild8-full\current\bin
installed before by scoop) to SystemPATH
- Goto to AWS Console and create image of preconfigured instance
- Make sure you required traffic could go to Windows from Jenkins. You can find
required ports above in
Configure Firewall
section