Skip to content
GitHubXDiscord

SyncConfiguration

The SyncConfiguration resource lets you manage AWS CodeStarConnections SyncConfigurations for synchronizing resources between your source control and AWS services.

Create a basic SyncConfiguration with required properties and one optional property:

import AWS from "alchemy/aws/control";
const basicSyncConfig = await AWS.CodeStarConnections.SyncConfiguration("basicSyncConfig", {
ConfigFile: "config.yml",
ResourceName: "MySyncConfig",
Branch: "main",
SyncType: "manual",
RepositoryLinkId: "abc123",
RoleArn: "arn:aws:iam::123456789012:role/my-role"
});

Configure a SyncConfiguration with all optional properties for more control over the synchronization process:

const advancedSyncConfig = await AWS.CodeStarConnections.SyncConfiguration("advancedSyncConfig", {
ConfigFile: "advanced-config.yml",
ResourceName: "AdvancedSyncConfig",
Branch: "develop",
SyncType: "automatic",
TriggerResourceUpdateOn: "commit",
RepositoryLinkId: "xyz789",
RoleArn: "arn:aws:iam::123456789012:role/my-advanced-role",
PublishDeploymentStatus: "true"
});

This example demonstrates how to set up a SyncConfiguration that updates resources based on commits to the repository:

const triggerSyncConfig = await AWS.CodeStarConnections.SyncConfiguration("triggerSyncConfig", {
ConfigFile: "trigger-config.yml",
ResourceName: "TriggerSyncConfig",
Branch: "feature",
SyncType: "manual",
TriggerResourceUpdateOn: "commit",
RepositoryLinkId: "def456",
RoleArn: "arn:aws:iam::123456789012:role/my-trigger-role"
});

In this example, the SyncConfiguration is set up to publish deployment status after synchronization:

const publishStatusSyncConfig = await AWS.CodeStarConnections.SyncConfiguration("publishStatusSyncConfig", {
ConfigFile: "publish-config.yml",
ResourceName: "PublishStatusSyncConfig",
Branch: "release",
SyncType: "automatic",
PublishDeploymentStatus: "true",
RepositoryLinkId: "ghi012",
RoleArn: "arn:aws:iam::123456789012:role/my-publish-role"
});