Estoy tratando de configurar la transmisión de píxeles en AWS, la mayoría de las cosas funcionan ahora, excepto un problema, hay un archivo config.json (que se muestra a continuación). la parte donde dice PublicIP tengo que agregar la ip de la instancia manualmente, ¿es posible hacerlo para que obtenga la IP en sí misma ya que quiero generar 50 instancias y no quiero ir a cada instancia y editar la 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 }Si puede ejecutar un script bash en el inicio del host, puede hacer esto:
Para sistemas Linux:
#!/bin/bash IP=$(curl -s https://checkip.amazonaws.com) sed -i "s/localhost/$IP/g" /path/to/config.jsonPara sistemas de ventanas:
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; }"La fuente de la URL de verificación de IP está aquí: https://docs.aws.amazon.com/cli/latest/userguide/cli-services-ec2-sg.html#configuring-a-security-group