Subchapter 33.3
references/codeconnections.mdMarkdown7 KBView on GitHub
Two ARN prefixes coexist (service was rebranded from CodeStar Connections to CodeConnections):
| Prefix | ARN Format |
|---|
codeconnections | arn:aws:codeconnections:REGION:ACCOUNT:connection/UUID |
codestar-connections | arn:aws:codestar-connections:REGION:ACCOUNT:connection/UUID |
Both work in pipeline configurations. IAM policy prefix must match the resource ARN prefix.
| Feature | GitHub | GitHub Enterprise | GitLab.com | GitLab Self-Managed | Bitbucket Cloud | Azure DevOps |
|---|---|---|---|---|---|---|
| Host resource required | No | Yes | No | Yes | No | No |
| Auth mechanism | GitHub App | GitHub App | OAuth | OAuth | OAuth | OAuth |
| Org owner required | Yes | Yes | No | No | No | No |
| VPC endpoint needed | No | Yes (if private) | No | Yes | No | No |
| Provider type value | GitHub | GitHubEnterpriseServer | GitLab | GitLabSelfManaged | Bitbucket | AzureDevOps |
aws codeconnections create-connection \
--provider-type GitHub \
--connection-name my-github-connection \
--tags Key=managed_by,Value=aws-skills Key=skill,Value=deployFor self-managed providers, use --host-arn instead of --provider-type:
aws codeconnections create-connection \
--host-arn arn:aws:codeconnections:REGION:ACCOUNT:host/HOST_ID \
--connection-name my-gitlab-sm-connectionCheck status:
aws codeconnections get-connection --connection-arn CONNECTION_ARN \
--query "Connection.ConnectionStatus" --output textConnections created via CLI/CloudFormation/CDK are always PENDING. There is NO API to complete authorization — the console OAuth handshake is mandatory.
A PENDING connection:
create-connectionPitfall: Non-owner members get cookie errors or blank pages. GitHub App installation REQUIRES org owner role.
Same flow as GitLab: Console → select connection → redirect → authorize → Connect.
aws codeconnections get-connection --connection-arn CONNECTION_ARN \
--query "Connection.ConnectionStatus" --output text
# Expected: AVAILABLERequired for GitHub Enterprise Server and GitLab Self-Managed. NOT needed for hosted providers.
aws codeconnections create-host \
--name my-gitlab-host \
--provider-type GitLabSelfManaged \
--provider-endpoint https://gitlab.internal.example.com \
--vpc-configuration VpcId=VPC_ID,SubnetIds=SUBNET_1,SUBNET_2,SecurityGroupIds=SG_ID,TlsCertificate=BASE64_PEM_CERT--vpc-configuration required when endpoint is not publicly accessible. TlsCertificate accepts PEM-encoded CA cert (base64).
Host creation is async — check status:
aws codeconnections get-host --host-arn HOST_ARN --query "Status" --output text
# Wait for: AVAILABLEA single connection serves unlimited pipelines within the same account and region. Create one connection per provider per account — do not create one per pipeline.
Cross-account: share connections using AWS Resource Access Manager (RAM). See sharing connections (opens in a new tab). Without RAM, each account needs its own connection.
Use codeconnections: prefix for all Actions. The dual prefix only matters in the Resource field (to match existing ARNs):
{
"Effect": "Allow",
"Action": [
"codeconnections:UseConnection"
],
"Resource": [
"arn:aws:codeconnections:REGION:ACCOUNT:connection/CONNECTION_UUID",
"arn:aws:codestar-connections:REGION:ACCOUNT:connection/OLD_CONNECTION_UUID"
],
"Condition": {
"StringEquals": {
"codeconnections:FullRepositoryId": "org/repo"
}
}
}CRITICAL: UseConnection is over-permissive without condition keys. It grants access to ALL repositories the connection can reach. MUST specify conditions:
| Condition Key | Purpose |
|---|---|
codeconnections:FullRepositoryId | Restrict to specific repo (e.g., org/repo) |
codeconnections:ProviderAction | Restrict operations (e.g., read only) |
codeconnections:BranchName | Restrict to specific branch |
For pipeline service roles: minimum codeconnections:UseConnection with condition keys scoped to the repo.
For CodeBuild roles using CODEBUILD_CLONE_REF: add codeconnections:UseConnection to the CodeBuild service role (not the pipeline role), with the same condition key scoping.
| Error/Symptom | Cause | Fix |
|---|---|---|
| Pipeline fails “connection not available” | Connection PENDING | Complete OAuth in console |
| Blank page / cookie error during GitHub auth | User not org owner | Have org owner perform installation |
AccessDeniedException on UseConnection | IAM only has one prefix | Add codeconnections:UseConnection and codestar-connections:UseConnection |
Host stuck in VPC_CONFIG_FAILED_INITIALIZATION | VPC/subnet/SG misconfiguration | Verify route to provider endpoint, validate TLS cert |
| Pipeline trigger never fires | sourceActionName mismatch | Ensure trigger sourceActionName matches action Name exactly |
| Repository not found | Wrong FullRepositoryId format | Use org/repo format (case-sensitive) |
codeconnections:* API auditing