Skip to content
GitHubXDiscord

Connection

The Connection resource allows you to manage AWS CodeConnections Connections that facilitate integrations between AWS services and external tools.

Create a basic connection with the required properties and an optional host ARN.

import AWS from "alchemy/aws/control";
const basicConnection = await AWS.CodeConnections.Connection("myBasicConnection", {
ConnectionName: "MyBasicConnection",
HostArn: "arn:aws:codeconnections:us-east-1:123456789012:host/my-host"
});

Configure a connection with additional properties like provider type and tags.

const advancedConnection = await AWS.CodeConnections.Connection("myAdvancedConnection", {
ConnectionName: "MyAdvancedConnection",
HostArn: "arn:aws:codeconnections:us-east-1:123456789012:host/my-host",
ProviderType: "GitHub",
Tags: [
{ Key: "Environment", Value: "Production" },
{ Key: "Team", Value: "DevOps" }
]
});

Create a connection that adopts an existing resource if it already exists.

const adoptConnection = await AWS.CodeConnections.Connection("myAdoptedConnection", {
ConnectionName: "MyAdoptedConnection",
HostArn: "arn:aws:codeconnections:us-east-1:123456789012:host/my-host",
ProviderType: "GitLab",
adopt: true
});

Update an existing connection by specifying its name and new properties.

const updatedConnection = await AWS.CodeConnections.Connection("myUpdatedConnection", {
ConnectionName: "MyUpdatedConnection",
HostArn: "arn:aws:codeconnections:us-east-1:123456789012:host/my-updated-host",
ProviderType: "Bitbucket",
Tags: [
{ Key: "Environment", Value: "Staging" }
]
});