Skip to content

AWS.CodeConnections reference

Source: src/AWS/CodeConnections/Connection.ts

An AWS CodeConnections connection to a source-code provider (GitHub, GitLab, Bitbucket).

A connection is created in the PENDING state. Completing it requires a one-time OAuth handshake performed manually in the AWS console (the “Update pending connection” flow) — there is no API to finish the handshake. Once completed the connection becomes AVAILABLE and can be referenced by a CodePipeline CodeStarSourceConnection action.

const connection = yield* CodeConnections.Connection("GitHub", {
providerType: "GitHub",
});
// connection.connectionStatus === "PENDING"
// Complete the handshake in the console before using it in a pipeline.

Source: src/AWS/CodeConnections/GetConnection.ts

Runtime binding for codeconnections:GetConnection.

Bind this operation to a Connection to read the connection’s live state — status (PENDING/AVAILABLE/ERROR), provider type, and owner — from inside a function runtime. Useful for workloads that gate work on the connection’s OAuth handshake having been completed. Provide the implementation with Effect.provide(AWS.CodeConnections.GetConnectionHttp).

// init — bind the operation to the connection
const getConnection = yield* AWS.CodeConnections.GetConnection(connection);
// runtime
const { Connection: live } = yield* getConnection();
if (live?.ConnectionStatus !== "AVAILABLE") {
return yield* HttpServerResponse.text("handshake pending", { status: 409 });
}

Source: src/AWS/CodeConnections/GetRepositorySyncStatus.ts

Runtime binding for codeconnections:GetRepositorySyncStatus.

Bind this operation to a RepositoryLink to read the latest Git sync attempt for a branch — its status and the sync events that led to it — from inside a function runtime. Useful for dashboards that surface whether a stack is in sync with its repository. Provide the implementation with Effect.provide(AWS.CodeConnections.GetRepositorySyncStatusHttp).

GetRepositorySyncStatus: Monitoring Git Sync

Section titled “GetRepositorySyncStatus: Monitoring Git Sync”
// init — bind the operation to the repository link
const getRepositorySyncStatus =
yield* AWS.CodeConnections.GetRepositorySyncStatus(link);
// runtime
const { LatestSync } = yield* getRepositorySyncStatus({
Branch: "main",
SyncType: "CFN_STACK_SYNC",
});

Source: src/AWS/CodeConnections/GetResourceSyncStatus.ts

Runtime binding for codeconnections:GetResourceSyncStatus.

Bind this operation to a SyncConfiguration to read the sync status of its Amazon Web Services resource — the desired state revision and the latest successful/attempted syncs — from inside a function runtime. Provide the implementation with Effect.provide(AWS.CodeConnections.GetResourceSyncStatusHttp).

GetResourceSyncStatus: Monitoring Git Sync

Section titled “GetResourceSyncStatus: Monitoring Git Sync”
// init — bind the operation to the sync configuration
const getResourceSyncStatus =
yield* AWS.CodeConnections.GetResourceSyncStatus(sync);
// runtime
const { LatestSync } = yield* getResourceSyncStatus();

Source: src/AWS/CodeConnections/GetSyncBlockerSummary.ts

Runtime binding for codeconnections:GetSyncBlockerSummary.

Bind this operation to a SyncConfiguration to read the latest sync blockers — errors that stop Git sync from converging the resource — from inside a function runtime. Pair with UpdateSyncBlocker to resolve them. Provide the implementation with Effect.provide(AWS.CodeConnections.GetSyncBlockerSummaryHttp).

GetSyncBlockerSummary: Monitoring Git Sync

Section titled “GetSyncBlockerSummary: Monitoring Git Sync”
// init — bind the operation to the sync configuration
const getSyncBlockerSummary =
yield* AWS.CodeConnections.GetSyncBlockerSummary(sync);
// runtime
const { SyncBlockerSummary } = yield* getSyncBlockerSummary();
const blockers = SyncBlockerSummary.LatestBlockers ?? [];

Source: src/AWS/CodeConnections/Host.ts

An AWS CodeConnections host — the infrastructure representation of a self-managed source provider (GitHub Enterprise Server or GitLab self-managed). One host serves all connections to that provider.

A host is created in the PENDING state. Completing it requires a one-time setup performed manually in the AWS console — there is no API to finish the setup. Once completed the host becomes AVAILABLE and Connections can reference it via hostArn.

GitHub Enterprise Server Host (created PENDING)

const host = yield* CodeConnections.Host("GHE", {
providerType: "GitHubEnterpriseServer",
providerEndpoint: "https://ghe.example.com",
});
// host.hostStatus === "PENDING"
// Complete the setup in the console before creating connections on it.

Connection on a Host

const connection = yield* CodeConnections.Connection("GHEConn", {
providerType: "GitHubEnterpriseServer",
hostArn: host.hostArn,
});
const host = yield* CodeConnections.Host("PrivateGHE", {
providerType: "GitHubEnterpriseServer",
providerEndpoint: "https://ghe.internal.example.com",
vpcConfiguration: {
vpcId: vpc.vpcId,
subnetIds: [subnetA.subnetId, subnetB.subnetId],
securityGroupIds: [securityGroup.securityGroupId],
},
});

Source: src/AWS/CodeConnections/ListConnections.ts

Runtime binding for codeconnections:ListConnections.

An account-level operation (no connection argument) that enumerates the account’s connections, optionally filtered by provider type or host. Useful for governance sweeps that audit which source providers are wired up. Provide the implementation with Effect.provide(AWS.CodeConnections.ListConnectionsHttp).

// init — account-level binding takes no resource
const listConnections = yield* AWS.CodeConnections.ListConnections();
// runtime
const result = yield* listConnections({ ProviderTypeFilter: "GitHub" });
const names = (result.Connections ?? []).map((c) => c.ConnectionName);

Source: src/AWS/CodeConnections/ListHosts.ts

Runtime binding for codeconnections:ListHosts.

An account-level operation (no host argument) that enumerates the account’s hosts — the self-managed provider endpoints (GitHub Enterprise Server, GitLab self-managed) that connections attach to. Useful for governance sweeps that audit which provider endpoints are registered. Provide the implementation with Effect.provide(AWS.CodeConnections.ListHostsHttp).

// init — account-level binding takes no resource
const listHosts = yield* AWS.CodeConnections.ListHosts();
// runtime
const result = yield* listHosts();
const urls = (result.Hosts ?? []).map((h) => h.ProviderEndpoint);

Source: src/AWS/CodeConnections/ListRepositoryLinks.ts

Runtime binding for codeconnections:ListRepositoryLinks.

An account-level operation (no repository-link argument) that enumerates the account’s repository links — the Git-sync attachments between a connection and a specific provider repository. Useful for sync dashboards that discover which repositories are wired up before drilling into their sync status. Provide the implementation with Effect.provide(AWS.CodeConnections.ListRepositoryLinksHttp).

// init — account-level binding takes no resource
const listRepositoryLinks =
yield* AWS.CodeConnections.ListRepositoryLinks();
// runtime
const result = yield* listRepositoryLinks();
const repos = (result.RepositoryLinks ?? []).map((l) => l.RepositoryName);

Source: src/AWS/CodeConnections/ListRepositorySyncDefinitions.ts

Runtime binding for codeconnections:ListRepositorySyncDefinitions.

Bind this operation to a RepositoryLink to enumerate the sync definitions Git sync tracks for the link — branch, directory, and target per definition. Provide the implementation with Effect.provide(AWS.CodeConnections.ListRepositorySyncDefinitionsHttp).

ListRepositorySyncDefinitions: Monitoring Git Sync

Section titled “ListRepositorySyncDefinitions: Monitoring Git Sync”
// init — bind the operation to the repository link
const listRepositorySyncDefinitions =
yield* AWS.CodeConnections.ListRepositorySyncDefinitions(link);
// runtime
const { RepositorySyncDefinitions } =
yield* listRepositorySyncDefinitions({ SyncType: "CFN_STACK_SYNC" });

Source: src/AWS/CodeConnections/ListSyncConfigurations.ts

Runtime binding for codeconnections:ListSyncConfigurations.

Bind this operation to a RepositoryLink to enumerate the sync configurations attached to the link — which AWS resources Git sync keeps converged from the linked repository. Provide the implementation with Effect.provide(AWS.CodeConnections.ListSyncConfigurationsHttp).

ListSyncConfigurations: Monitoring Git Sync

Section titled “ListSyncConfigurations: Monitoring Git Sync”
// init — bind the operation to the repository link
const listSyncConfigurations =
yield* AWS.CodeConnections.ListSyncConfigurations(link);
// runtime
const { SyncConfigurations } =
yield* listSyncConfigurations({ SyncType: "CFN_STACK_SYNC" });

Source: src/AWS/CodeConnections/RepositoryLink.ts

An AWS CodeConnections repository link — associates a connection with a specific external Git repository so Git sync can monitor and sync changes (e.g. CloudFormation git sync).

Requires a connection in the AVAILABLE state; the connection’s OAuth handshake is a one-time manual console step.

Link a GitHub Repository

const link = yield* CodeConnections.RepositoryLink("Repo", {
connectionArn: connection.connectionArn,
ownerId: "my-github-org",
repositoryName: "my-repo",
});

Encrypted Repository Link

const link = yield* CodeConnections.RepositoryLink("Repo", {
connectionArn: connection.connectionArn,
ownerId: "my-github-org",
repositoryName: "my-repo",
encryptionKeyArn: key.keyArn,
});

Source: src/AWS/CodeConnections/SyncConfiguration.ts

An AWS CodeConnections sync configuration — connects a repository link’s branch + deployment file to an Amazon Web Services resource so Git sync keeps the resource updated from the repository (CloudFormation stack sync).

SyncConfiguration: Syncing a CloudFormation Stack

Section titled “SyncConfiguration: Syncing a CloudFormation Stack”

Stack Sync from a Repository Link

const sync = yield* CodeConnections.SyncConfiguration("StackSync", {
branch: "main",
configFile: "deployments/stack-deployment.yaml",
repositoryLinkId: link.repositoryLinkId,
resourceName: "my-stack",
roleArn: gitSyncRole.roleArn,
});

Sync Only on Deployment-File Changes

const sync = yield* CodeConnections.SyncConfiguration("StackSync", {
branch: "main",
configFile: "deployments/stack-deployment.yaml",
repositoryLinkId: link.repositoryLinkId,
resourceName: "my-stack",
roleArn: gitSyncRole.roleArn,
triggerResourceUpdateOn: "FILE_CHANGE",
pullRequestComment: "DISABLED",
});

Source: src/AWS/CodeConnections/UpdateSyncBlocker.ts

Runtime binding for codeconnections:UpdateSyncBlocker.

Bind this operation to a SyncConfiguration to resolve a sync blocker (discovered via GetSyncBlockerSummary) so Git sync can resume converging the resource. Provide the implementation with Effect.provide(AWS.CodeConnections.UpdateSyncBlockerHttp).

// init — bind the operation to the sync configuration
const updateSyncBlocker = yield* AWS.CodeConnections.UpdateSyncBlocker(sync);
// runtime
yield* updateSyncBlocker({
Id: blocker.Id,
ResolvedReason: "stack drift corrected manually",
});