Skip to content
GitHubXDiscord

Location

The Location resource allows you to manage AWS GameLift Locations for deploying game servers across various geographic regions to optimize performance and latency.

Create a basic GameLift location with required properties.

import AWS from "alchemy/aws/control";
const gameLiftLocation = await AWS.GameLift.Location("myGameLiftLocation", {
LocationName: "us-west-2",
Tags: [
{ Key: "Environment", Value: "Production" },
{ Key: "Project", Value: "GameServerDeployment" }
]
});

Configure a GameLift location with the adoption option enabled, allowing you to adopt an existing resource if it already exists.

const adoptedLocation = await AWS.GameLift.Location("adoptedGameLiftLocation", {
LocationName: "eu-central-1",
adopt: true,
Tags: [
{ Key: "Environment", Value: "Staging" },
{ Key: "Project", Value: "Testing" }
]
});

Access the metadata of a GameLift location, including its ARN, creation time, and last update time.

const locationMetadata = await AWS.GameLift.Location("locationMetadata", {
LocationName: "ap-south-1"
});
// Log the metadata details
console.log(`ARN: ${locationMetadata.Arn}`);
console.log(`Created At: ${locationMetadata.CreationTime}`);
console.log(`Last Updated At: ${locationMetadata.LastUpdateTime}`);

Create a location with meaningful tags for better resource management and organization.

const taggedLocation = await AWS.GameLift.Location("taggedLocation", {
LocationName: "us-east-1",
Tags: [
{ Key: "Owner", Value: "GameDevTeam" },
{ Key: "Version", Value: "1.0" }
]
});