-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser-data.ps1
26 lines (22 loc) · 1.08 KB
/
user-data.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<powershell>
#Variables
$appdir = "c:\inetpub\test_app"
$file = "index.html"
$site = "test_app"
$id = "2"
$port = "8080:"
$bucket = "gltest-bucket"
#Install IIS and open port 8080 in firewall
Install-WindowsFeature -name Web-Server -IncludeManagementTools
netsh advfirewall firewall add rule name="Port 8080 for test_app" dir=in action=allow protocol=TCP localport=8080
#Download index.html
New-Item -Path $appdir -ItemType "directory" -Force
#Set-ExecutionPolicy RemoteSigned
#Import-Module AWSPowerShell
Read-S3Object -BucketName $bucket -Key $file -File $appdir\$file
#Deploy site
C:\Windows\System32\inetsrv\appcmd.exe add site /name:$site /id:$id /physicalPath:$appdir\ /bindings:http/*:$port
#Create users with administrative rights
New-LocalUser -AccountNeverExpires:$true -Password ( ConvertTo-SecureString -AsPlainText -Force 'somepassworD123@') -Name 'Admin2' | Add-LocalGroupMember -Group administrators
New-LocalUser -AccountNeverExpires:$true -Password ( ConvertTo-SecureString -AsPlainText -Force 'somepassworD123@') -Name 'Admin3' | Add-LocalGroupMember -Group administrators
</powershell>