ServiceNetwork
The ServiceNetwork resource allows you to manage AWS VpcLattice ServiceNetworks that facilitate service communication and discovery across VPCs.
Minimal Example
Section titled “Minimal Example”Create a basic ServiceNetwork with a name and authentication type.
import AWS from "alchemy/aws/control";
const basicServiceNetwork = await AWS.VpcLattice.ServiceNetwork("basicServiceNetwork", { name: "MyServiceNetwork", authType: "NONE", // No authentication required});
Advanced Configuration
Section titled “Advanced Configuration”Configure a ServiceNetwork with sharing options and tags for better organization.
const advancedServiceNetwork = await AWS.VpcLattice.ServiceNetwork("advancedServiceNetwork", { name: "AdvancedServiceNetwork", authType: "IAM", sharingConfig: { allowExternal: true, externalPrincipals: ["arn:aws:iam::123456789012:role/ExternalServiceRole"] }, tags: [ { Key: "Environment", Value: "Development" }, { Key: "Project", Value: "ServiceDiscovery" } ]});
Adoption of Existing Resource
Section titled “Adoption of Existing Resource”Create a ServiceNetwork that adopts an existing resource rather than failing if it already exists.
const existingServiceNetwork = await AWS.VpcLattice.ServiceNetwork("existingServiceNetwork", { name: "ExistingServiceNetwork", adopt: true // Adopt an existing resource if it already exists});
Tagging for Organization
Section titled “Tagging for Organization”Demonstrate how to use tags to organize your ServiceNetworks effectively.
const taggedServiceNetwork = await AWS.VpcLattice.ServiceNetwork("taggedServiceNetwork", { name: "TaggedServiceNetwork", tags: [ { Key: "Owner", Value: "DevTeam" }, { Key: "Purpose", Value: "Testing" } ]});