GlobalNetwork
Learn how to create, update, and manage AWS NetworkManager GlobalNetworks using Alchemy Cloud Control.
The GlobalNetwork resource lets you manage AWS NetworkManager GlobalNetworks which facilitate the creation and management of a global network across multiple AWS Regions.
Minimal Example
Section titled “Minimal Example”Create a basic Global Network with a description and tags.
import AWS from "alchemy/aws/control";
const globalNetwork = await AWS.NetworkManager.GlobalNetwork("myGlobalNetwork", { Description: "My global network for branch connectivity", Tags: [ { Key: "Environment", Value: "Production" }, { Key: "Project", Value: "GlobalExpansion" } ]});
Advanced Configuration
Section titled “Advanced Configuration”Create a Global Network with a defined state and additional properties.
const advancedGlobalNetwork = await AWS.NetworkManager.GlobalNetwork("myAdvancedGlobalNetwork", { Description: "Advanced global network configuration", State: "ACTIVE", // Possible values: PENDING | ACTIVE | DELETING | DELETED Tags: [ { Key: "Department", Value: "IT" }, { Key: "Owner", Value: "Alice" } ], adopt: true // Adopt existing resource if present});
Monitoring Creation Time
Section titled “Monitoring Creation Time”Utilize the created time property to monitor when the Global Network was established.
const networkWithCreationTime = await AWS.NetworkManager.GlobalNetwork("myNetworkWithCreationTime", { Description: "Global network with creation monitoring", Tags: [ { Key: "Service", Value: "NetworkManagement" } ]});
// Log the creation time of the Global Networkconsole.log(`Global Network created at: ${networkWithCreationTime.CreationTime}`);
Handling State Changes
Section titled “Handling State Changes”Set up a Global Network and handle state changes programmatically.
const stateChangeNetwork = await AWS.NetworkManager.GlobalNetwork("myStateChangeNetwork", { Description: "Network to demonstrate state handling", State: "PENDING"});
// Example of checking and updating stateif (stateChangeNetwork.State === "PENDING") { console.log("Network is still pending, please check back later."); // Logic to update or retry can be added here}