The shared credentials file is not usable with the current example, can these be added to prevent confusion?
In production-deployment-sample-script/models/parsed_fleet.py under the ParsedFleet model.
self.instance_role_credentials_provider = fleet_json.get("InstanceRoleCredentialsProvider")
class ParsedFleet:
def __init__(self, json_file: str):
self.json_file = json_file
try:
with open(json_file, 'r') as file:
fleet_json = json.load(file)
# Mandatory inputs indexed directly to throw KeyError
self.name = fleet_json['Name']
self.ec2_instance_type = fleet_json['EC2InstanceType']
self.runtime_configuration = fleet_json['RuntimeConfiguration']
# Optional inputs read with json get
self.build_id = fleet_json.get('BuildId') # BuildId will be replaced even if set in json file
self.description = fleet_json.get('Description')
self.ec2_inbound_permissions = fleet_json.get('EC2InboundPermissions')
self.new_game_session_protection_policy = fleet_json.get('NewGameSessionProtectionPolicy')
self.resource_creation_limit_policy = fleet_json.get('ResourceCreationLimitPolicy')
self.metric_groups = fleet_json.get('MetricGroups')
self.peer_vpc_aws_account_id = fleet_json.get('PeerVpcAwsAccountId')
self.peer_vpc_id = fleet_json.get('PeerVpcId')
self.fleet_type = fleet_json.get('FleetType')
self.instance_role_arn = fleet_json.get('InstanceRoleArn')
self.certificate_configuration = fleet_json.get('CertificateConfiguration')
self.locations = fleet_json.get('Locations')
self.tags = fleet_json.get('Tags')
self.compute_type = fleet_json.get('ComputeType')
self.anywhere_configuration = fleet_json.get('AnywhereConfiguration'),
self.instance_role_credentials_provider = fleet_json.get("InstanceRoleCredentialsProvider")
except KeyError as e:
print("Mandatory Fleet input: %s" % e)
raise e
except ValueError as e:
print("Exception parsing Fleet json: %s" % e)
raise e
and then in production-deployment-sample-script/utils/game_lift_client.py under create_fleet
InstanceRoleCredentialsProvider=parsed_fleet.instance_role_credentials_provider,
def create_fleet(self, parsed_fleet: ParsedFleet):
callargs = dict(Name=parsed_fleet.name,
BuildId=parsed_fleet.build_id,
EC2InstanceType=parsed_fleet.ec2_instance_type,
RuntimeConfiguration=parsed_fleet.runtime_configuration,
Description=parsed_fleet.description,
EC2InboundPermissions=parsed_fleet.ec2_inbound_permissions,
NewGameSessionProtectionPolicy=parsed_fleet.new_game_session_protection_policy,
ResourceCreationLimitPolicy=parsed_fleet.resource_creation_limit_policy,
MetricGroups=parsed_fleet.metric_groups,
PeerVpcAwsAccountId=parsed_fleet.peer_vpc_aws_account_id,
PeerVpcId=parsed_fleet.peer_vpc_id,
FleetType=parsed_fleet.fleet_type,
InstanceRoleArn=parsed_fleet.instance_role_arn,
CertificateConfiguration=parsed_fleet.certificate_configuration,
Locations=parsed_fleet.locations,
Tags=parsed_fleet.tags,
ComputeType=parsed_fleet.compute_type,
InstanceRoleCredentialsProvider=parsed_fleet.instance_role_credentials_provider,
AnywhereConfiguration=parsed_fleet.anywhere_configuration)
The shared credentials file is not usable with the current example, can these be added to prevent confusion?
In
production-deployment-sample-script/models/parsed_fleet.pyunder the ParsedFleet model.self.instance_role_credentials_provider = fleet_json.get("InstanceRoleCredentialsProvider")and then in
production-deployment-sample-script/utils/game_lift_client.pyunder create_fleetInstanceRoleCredentialsProvider=parsed_fleet.instance_role_credentials_provider,