Skip to content
GitHubXDiscord

EnvironmentAccountConnection

The EnvironmentAccountConnection resource lets you manage AWS Proton EnvironmentAccountConnections that facilitate the connection between a management account and an environment account.

Create a basic EnvironmentAccountConnection with required properties and some common optional settings.

import AWS from "alchemy/aws/control";
const basicConnection = await AWS.Proton.EnvironmentAccountConnection("basicConnection", {
EnvironmentName: "ProductionEnvironment",
ComponentRoleArn: "arn:aws:iam::123456789012:role/ProtonComponentRole",
ManagementAccountId: "123456789012",
CodebuildRoleArn: "arn:aws:iam::123456789012:role/ProtonCodeBuildRole",
EnvironmentAccountId: "098765432109"
});

Configure an EnvironmentAccountConnection with additional tags for better management and identification.

const advancedConnection = await AWS.Proton.EnvironmentAccountConnection("advancedConnection", {
EnvironmentName: "StagingEnvironment",
ComponentRoleArn: "arn:aws:iam::123456789012:role/ProtonComponentRole",
ManagementAccountId: "123456789012",
CodebuildRoleArn: "arn:aws:iam::123456789012:role/ProtonCodeBuildRole",
EnvironmentAccountId: "098765432109",
RoleArn: "arn:aws:iam::123456789012:role/ProtonRole",
Tags: [
{ Key: "Environment", Value: "Staging" },
{ Key: "Project", Value: "WebApp" }
]
});

Adopt an existing EnvironmentAccountConnection instead of failing if it already exists.

const adoptConnection = await AWS.Proton.EnvironmentAccountConnection("adoptConnection", {
EnvironmentName: "ExistingEnvironment",
ComponentRoleArn: "arn:aws:iam::123456789012:role/ProtonComponentRole",
ManagementAccountId: "123456789012",
CodebuildRoleArn: "arn:aws:iam::123456789012:role/ProtonCodeBuildRole",
EnvironmentAccountId: "098765432109",
adopt: true
});