AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides guidance on configuring and managing end-to-end CI/CD pipelines within the AWS ecosystem. It covers the integration of source control connections, build environments, package management, and deployment strategies. The content focuses on service orchestration, security best practices, and troubleshooting common infrastructure-level failures in build and deployment processes.
What it does
- Configures CI/CD pipelines using CodePipeline and CodeConnections.
- Defines build environments and buildspec logic for CodeBuild.
- Manages private package registries via CodeArtifact.
- Implements deployment strategies like blue/green, canary, and linear using CodeDeploy.
- Provides troubleshooting steps for pipeline, build, and deployment failures.
- Details security configurations for service roles and cross-account access.
When to use it
- When setting up automated build and deployment pipelines on AWS.
- When integrating external source providers like GitHub, GitLab, or Bitbucket.
- When managing private dependencies for build processes.
- When implementing traffic shifting strategies for application updates.
- When debugging pipeline stalls or deployment errors.
Advantages
- Native integration with AWS security and IAM policies.
- Supports complex deployment patterns like blue/green and canary.
- Enables secure cross-account artifact management.
- Provides centralized control over build and deployment phases.
Usage examples
- “How do I set up a pipeline that pulls from GitHub and deploys to ECS?”
- The agent provides a sequence to create a connection, configure a build stage for container packaging, and set up a deployment stage using blue/green traffic shifting.
- “My CodeBuild project is hanging at the download source phase.”
- The agent identifies the likely cause as a VPC configuration issue and suggests verifying the presence of a NAT gateway in the private subnets.
- “How can I share packages across different AWS accounts?”
- The agent explains how to configure CodeArtifact domain policies and use customer-managed KMS keys to enable cross-account access.
- “How do I handle a failed deployment in CodeDeploy?”
- The agent outlines how to use automated rollback settings or manual commands to stop and revert the deployment.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/aws/aws-deployment/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip aws-deployment.zip -d .agents/skills
Documentation by AWS
AWS Deploy (CI/CD)
Works best with the AWS MCP server for running CLI commands and validating configurations directly. All guidance also works with standard AWS CLI.
Critical Warnings
CodeConnections PENDING trap: Connections created via CLI/CloudFormation remain PENDING indefinitely — MUST complete OAuth in the AWS Console. No API-only path exists.
Cross-account triple requirement: Cross-account deploys need ALL THREE: (1) KMS key policy granting target account (use key ID, not alias), (2) S3 bucket policy for target account, (3) cross-account IAM role with trust policy. Missing any one = cryptic Access Denied.
CodeDeploy ApplicationStop uses PREVIOUS revision: Broken stop scripts in a prior deployment block ALL future deploys. Make stop scripts idempotent (exit 0 if service absent). Unblock with --ignore-application-stop-failures.
CodeBuild VPC without NAT: Builds in VPC subnets without NAT gateway hang at DOWNLOAD_SOURCE silently. Private subnets MUST have NAT gateway or VPC endpoints.
CodeConnections IAM: Use codeconnections: prefix for API calls and IAM policy Actions. Resource ARNs must match exactly — new resources use codeconnections prefix, existing resources may use codestar-connections prefix. Specify both in Resource if you have mixed-age resources.
UseConnection is over-permissive: codeconnections:UseConnection grants access to ALL repositories the connection can reach. MUST specify condition keys (codeconnections:FullRepositoryId, codeconnections:ProviderAction, codeconnections:BranchName) to limit CodeBuild to only the required repository.
How These Services Compose
CodeConnections → CodeBuild → CodeDeploy, orchestrated by CodePipeline.
| Layer | Service | Role |
|---|---|---|
| Source | CodeConnections | Authenticates to GitHub/GitLab/Bitbucket, delivers code |
| Packages | CodeArtifact | Private package registry, dependency caching from public registries |
| Build/Test | CodeBuild | Compiles, tests, packages artifacts |
| Deploy | CodeDeploy | Deploys to EC2/ECS/Lambda with traffic shifting strategies |
| Orchestrator | CodePipeline | Chains stages, manages transitions, approval gates |
Default: V2 pipeline type with QUEUED execution mode. Use PARALLEL only when executions are fully independent.
Quick Navigation
| You want to... | Go to |
|---|---|
| Create a pipeline (V2, triggers, variables, modes) | codepipeline.md |
| Connect GitHub/GitLab/Bitbucket source | codeconnections.md |
| Write buildspec.yml / configure builds | codebuild.md |
| Set up private package registry for builds | codeartifact.md |
| Configure deployment strategy (blue/green, canary) | codedeploy.md |
| Cross-account or cross-region deployment | codepipeline.md |
| Fix failing pipeline, build, or deployment | troubleshooting.md |
Common Workflows
| Task | Action | Reference |
|---|---|---|
| Pipeline from GitHub to ECS | Create connection → CodeBuild Docker stage → CodeDeploy ECS blue/green | codepipeline, codedeploy |
| Pipeline stuck at source | Check connection status; if PENDING, complete OAuth in AWS Console | troubleshooting |
| Build timing out | Check VPC/NAT, increase timeoutInMinutes, verify Docker privileged mode | codebuild |
| Deploy to another account | Configure KMS + S3 bucket policy + cross-account role, add RoleArn to action | codepipeline |
| Roll back failed deployment | Auto-rollback on alarm/failure; manual: stop-deployment --auto-rollback-enabled | codedeploy |
| Lambda canary deployment | CodeBuild packages → CodeDeploy Lambda with canary traffic shifting | codedeploy |
Troubleshooting
| Error/Symptom | Cause | Fix |
|---|---|---|
YAML_FILE_ERROR in CodeBuild | Missing or malformed runtime-versions in buildspec (recommended for standard images) | Add runtime-versions block in install phase |
file already exists on CodeDeploy | Redeployment without overwrite config | Set file_exists_behavior: OVERWRITE |
| Pipeline trigger not firing | File path filter checks only first 100 files in diff | Reduce path filter scope or merge smaller |
| PARALLEL mode wrong revision | Race between event and source action | Use QUEUED mode for sequential consistency |
Docker: Cannot connect to daemon | Missing privileged mode | Set privilegedMode: true AND start dockerd in buildspec |
CODEBUILD_CLONE_REF permission error | CodeBuild role missing UseConnection | Add codeconnections:UseConnection to CodeBuild service role |
| Deployment never completes | MinimumHealthyHosts too high for instance count | Ensure healthy threshold < total instances |
| ECS deployment stuck | Health check failing on new task set | Verify target group health check path/port |
Security
MUST store secrets in Secrets Manager or Parameter Store; reference via CodeBuild
type: SECRETS_MANAGER— MUST NOT embed in buildspec as PLAINTEXTMUST use customer-managed KMS keys for cross-account artifact encryption (default encryption does not support cross-account)
SHOULD scope CodeBuild/CodeDeploy service roles to specific resource ARNs; MUST NOT use
*fors3:GetObjectorkms:DecryptMUST use CodeConnections (not personal access tokens) for source connections; OAuth tokens cannot be rotated automatically
See CodePipeline security best practices for comprehensive guidance
Not Covered
| Topic | Use instead |
|---|---|
CDK Pipelines (aws-cdk-lib/pipelines) | aws-cdk |
sam deploy / SAM CLI | aws-serverless |
| ECS service deployment config (circuit breaker, rolling params) | aws-containers |
| GitHub Actions / GitLab CI | Third-party tools, not covered |
Files
- ATTRIBUTION.mdAdded by AutoGineer893 B
- LICENSELicence file added by AutoGineer9.9 KiB
- NOTICELicence file added by AutoGineer67 B
- SKILL.md7.0 KiB
- references/codeartifact.md6.4 KiB
- references/codebuild.md7.3 KiB
- references/codeconnections.md6.8 KiB
- references/codedeploy.md10.4 KiB
- references/codepipeline.md10.3 KiB
- references/troubleshooting.md7.9 KiB
references/codeconnections.md
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
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 textThe 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-connectionPasses ARN validation in pipeline definitions
Silently fails when the pipeline fetches source
Authorize a Connection (Console Required)
GitHub / GitHub Enterprise
AWS Console → Developer Tools > Settings > Connections
Select PENDING connection → Update pending connection
Install a new app (or select existing GitHub App)
Browser redirects to GitHub — sign in as organization owner
Select org, choose repos → Install
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
AWS Console → Developer Tools > Settings > Connections
Select PENDING connection → Update pending connection
Redirects to GitLab → authorize the AWS application
Connect to finalize
Bitbucket Cloud
Same flow as GitLab: Console → select connection → redirect → authorize → Connect.
Verify
aws codeconnections get-connection --connection-arn CONNECTION_ARN \
--query "Connection.ConnectionStatus" --output text
# Expected: AVAILABLECreate a Host Resource (Self-Managed Only)
Required 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: AVAILABLEConnection 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. 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):
{
"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 auditingRevoke 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 for source action and trigger configuration
troubleshooting.md for pipeline-level debugging
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs an MCP server
Security
What our scanner noticed· Low risk
- Instructions that use the network
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- AWS
- Publisher
- AWS (Official)
- Source
- aws/agent-toolkit-for-aws · skills/core-skills/aws-deployment · commit 0a218f8
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- NOTICE (added by AutoGineer from NOTICE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Also distributed in
- aws/agent-toolkit-for-aws
AutoGineer is not affiliated with or endorsed by AWS.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download aws-deployment.zip