2개 답변
- 최신
- 최다 투표
- 가장 많은 댓글
0
Hi @REDACTEDUSER
Those are certainly possible.
For DNS name of the instance, you'd need to use EC2 metadata, see "HostName" in https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-categories.html. Here is how you can retrieve the data: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
Port, on the other hand, is under your control. The recommendation is to pass them in via command line argument when executing your game server process, e.g.
aws gamelift create-fleet --region $REGION \
--name "TestFleet" --ec2-instance-type c5.large \
--ec2-inbound-permissions FromPort=6252,ToPort=6254,IpRange="0.0.0.0/0",Protocol=TCP FromPort=22,ToPort=22,IpRange="0.0.0.0/0",Protocol=TCP \
--build-id $BUILD_ID \
--runtime-configuration ServerProcesses="[{LaunchPath="/local/game/gamelift-test-app",Parameters='port:6251 gameSessionLengthSeconds:10',ConcurrentExecutions=1},\
{LaunchPath="/local/game/gamelift-test-app",Parameters='port:6252 gameSessionLengthSeconds:10',ConcurrentExecutions=1},\
{LaunchPath="/local/game/gamelift-test-app",Parameters='port:6253 gameSessionLengthSeconds:10',ConcurrentExecutions=1},\
{LaunchPath="/local/game/gamelift-test-app",Parameters='port:6254 gameSessionLengthSeconds:10',ConcurrentExecutions=1}]"
Then, in my gamelift-test-app
, I retrieve the port
parameter from the CLI and use that for ProcessReady.
답변함 3년 전
관련 콘텐츠
- AWS 공식업데이트됨 2년 전