Introspection on GameLift EC2 instance

0

We have a number of different accounts, A1, A2, AN, ("tiers", dev, test, live, etc) and they all contain builds and fleets, which then get instantiated in AWS managed accounts B1, B2, BN. I've tried manually assuming the fleet-******

I can get EC2 instance meta-data, so I can figure out the account ID of B1-Bx, but since I never know these up-front, I can't easily create a mapping back to A1-Ax, which makes it impossible to determine a) which role I can assume, and also b) which backend tier to connect to, without making individual builds for each tier.

I tried using tags, but the instance role has no access, and I don't know if any of the build or fleets tags get applied to the EC2 anyway. If I defer things to after servers have started up, I could theoretically make a late binding from server IP to instance, but it happens a bit later than I would prefer.

Cheers!

demandé il y a 3 ans204 vues
4 réponses
0
Réponse acceptée

Hi,

GameLift team has recently added a metadata file in GameLift instances containing the information you need, and we are working on getting this documented. (GLIFT-15647)

In the meantime, you can be unblocked by reading the a metadata JSON file from this path:

  • /local/gamemetadata/gamelift-metadata.json (In Linux)
  • C:\GameMetadata\gamelift-metadata.json (In Windows)

This metadata contains the following fleet attributes as of this writing:

BuildArn
BuildId
FleetArn
FleetId
Description
Name  // AKA Fleet Name
ScriptArn  // If you are using Realtime Server
ScriptId  // If you are using Realtime Server
FleetType
InstanceType
InstanceRoleArn  // if you provide an instance role during fleet creation

This file is created prior to install.sh is run, so it is guaranteed to be readable by your install script. You could potentially add your build environment (test, dev, live, etc.) as a part of the fleet name, or make an additional call to DescribeBuild to get the build name instead.

Thanks, James

répondu il y a 3 ans
0

Just FYI, here is an example of the JSON file content (after formatting, originally it's just a single line without spaces):

{
   "buildArn":"arn:******
   "buildId":"build-11223344-5566-7788-aabbcceeffgg",
   "fleetArn":"arn:******
   "fleetId":"fleet-******
   "description":"MyFleetDescription",
   "name":"MyFleetName",
   "fleetType":"ON_DEMAND",
   "instanceType":"c5.large"
}
répondu il y a 3 ans
0

Absolutely brilliant, much appreciated! Thanks @REDACTEDUSER

répondu il y a 3 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions