I am trying to configure pixelstreaming on AWS, most of the things are working now except one hitch, there is a config.json file (given below). the part where it says PublicIP i have to add the ip of the instance manually, is it possible to make it so it gets the IP itself since i want to spawn 50 instances and do not want to go to each instance and edit the IP.
{
"UseFrontend": false,
"UseMatchmaker": true,
"UseHTTPS": false,
"UseAuthentication": false,
"LogToFile": true,
"HomepageFile": "/public/player.html",
"AdditionalRoutes": {},
"EnableWebserver": true,
"MatchmakerAddress": "",
"MatchmakerPort": "9999",
"PublicIp": "localhost",
"HttpPort": 80,
"HttpsPort": 443,
"StreamerPort": 8888
}
If you can execute a bash script on host startup, you could do this:
For linux systems:
#!/bin/bash
IP=$(curl -s https://checkip.amazonaws.com)
sed -i "s/localhost/$IP/g" /path/to/config.json
For windows systems:
powershell -Command "& {$filePath = 'C:\Path\to\your\config.json'; $response = (Invoke-WebRequest -UseBasicParsing -Uri 'https://checkip.amazonaws.com').Content; $body = [System.Text.Encoding]::UTF8.GetString($response); $clean = $body.Trim(); (Get-Content $filePath) -replace 'localhost', $clean | Out-File -encoding UTF8 $filePath; }"
Source for IP check url is here: https://docs.aws.amazon.com/cli/latest/userguide/cli-services-ec2-sg.html#configuring-a-security-group