opensite-ai/opensite-skills / aws-deployment
aws-deployment
UnverifiedConfigures CI/CD pipelines using AWS CodePipeline, CodeBuild, CodeDeploy, CodeConnections, and CodeArtifact. Covers CodePipeline V2 (triggers, variables, execution modes, cross-account), buildspec.yml (caching, VPC, Docker), CodeDeploy strategies (blue/green, canary, linear), CodeArtifact (private package registries, auth tokens, cross-account), and source connections (GitHub, GitLab, Bitbucket). Applies when CodePipeline, CodeBuild, CodeDeploy, CodeConnections, CodeArtifact, buildspec.yml, appspec.yml, or CI/CD pipeline orchestration is referenced. Does NOT cover: ECS Fargate services or task definitions (use aws-containers), CDK Pipelines or cdk deploy (use aws-cdk), sam deploy (use aws-serverless), Amplify deployments (use aws-amplify), or GitHub Actions/GitLab CI.
| File | Kind | Size |
|---|---|---|
| .aws-skill-metadata | other | 18 B |
| SKILL.md | skill md | 7.0 KB |
| references/codeartifact.md | markdown | 6.4 KB |
| references/codebuild.md | markdown | 7.3 KB |
| references/codeconnections.md | markdown | 6.8 KB |
| references/codedeploy.md | markdown | 10.4 KB |
| references/codepipeline.md | markdown | 10.3 KB |
| references/troubleshooting.md | markdown | 7.9 KB |
references/codeconnections.md
View on GitHub# CodeConnections
## Service Prefixes
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.
## Provider Comparison
| 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` |
## Create a Connection
```bash
aws codeconnections create-connection \
--provider-type GitHub \
--connection-name my-github-connection \
--tags Key=managed_by,Value=aws-skills Key=skill,Value=deploy
```
For self-managed providers, use `--host-arn` instead of `--provider-type`:
```bash
aws codeconnections create-connection \
--host-arn arn:aws:codeconnections:REGION:ACCOUNT:host/HOST_ID \
--connection-name my-gitlab-sm-connection
```
Check status:
```bash
aws codeconnections get-connection --connection-arn CONNECTION_ARN \
--query "Connection.ConnectionStatus" --output text
```
## The PENDING State Trap
Connections created via CLI/CloudFormation/CDK are **always** `PENDING`. There is NO API to complete authorization — the console OAuth handshake is mandatory.
A PENDING connection:
- Returns no errors from `create-connection`
- Passes ARN validation in pipeline definitions
- **Silently fails** when the pipeline fetches source
## Authorize a Connection (Console Required)
### GitHub / GitHub Enterprise
1. AWS Console → **Developer Tools > Settings > Connections**
2. Select PENDING connection → **Update pending connection**
3. **Install a new app** (or select existing GitHub App)
4. Browser redirects to GitHub — sign in as **organization owner**
5. Select org, choose repos → **Install**
6. Back in AWS Console → **Connect**
**Pitfall**: Non-owner members get cookie errors or blank pages. GitHub App installation REQUIRES org owner role.
### GitLab.com / GitLab Self-Managed
1. AWS Console → **Developer Tools > Settings > Connections**
2. Select PENDING connection → **Update pending connection**
3. Redirects to GitLab → authorize the AWS application
4. **Connect** to finalize
### Bitbucket Cloud
Same flow as GitLab: Console → select connection → redirect → authorize → Connect.
### Verify
```bash
aws codeconnections get-connection --connection-arn CONNECTION_ARN \
--query "Connection.ConnectionStatus" --output text
# Expected: AVAILABLE
```
## Create a Host Resource (Self-Managed Only)
Required for GitHub Enterprise Server and GitLab Self-Managed. NOT needed for hosted providers.
```bash
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:
```bash
aws codeconnections get-host --host-arn HOST_ARN --query "Status" --output text
# Wait for: AVAILABLE
```
## Connection Sharing
A 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](https://docs.aws.amazon.com/dtconsole/latest/userguide/connections-share.html). Without RAM, each account needs its own connection.
## IAM Configuration
Use `codeconnections:` prefix for all Actions. The dual prefix only matters in the `Resource` field (to match existing ARNs):
```json
{
"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.
## Common Errors
| 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) |
## Security
- MUST scope UseConnection with condition keys (FullRepositoryId, ProviderAction) — without them, any repo accessible to the connection is exposed
- Scope Resource to specific connection ARNs in production
- Enable CloudTrail for `codeconnections:*` API auditing
- Revoke connections when personnel with OAuth access leave the organization
- Connections store OAuth tokens managed by AWS — prefer connections over manual PATs which cannot be auto-rotated
## Related
- [codepipeline.md](codepipeline.md) for source action and trigger configuration
- [troubleshooting.md](troubleshooting.md) for pipeline-level debugging
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |