aws-deployment

작성자: aws

AWS CodePipeline, CodeBuild, CodeDeploy, CodeConnections, CodeArtifact를 사용하여 CI/CD 파이프라인을 구성합니다. CodePipeline V2(트리거, 변수, …)를 다룹니다.

npx skills add https://github.com/aws/agent-toolkit-for-aws --skill aws-deployment

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.

LayerServiceRole
SourceCodeConnectionsAuthenticates to GitHub/GitLab/Bitbucket, delivers code
PackagesCodeArtifactPrivate package registry, dependency caching from public registries
Build/TestCodeBuildCompiles, tests, packages artifacts
DeployCodeDeployDeploys to EC2/ECS/Lambda with traffic shifting strategies
OrchestratorCodePipelineChains 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 sourcecodeconnections.md
Write buildspec.yml / configure buildscodebuild.md
Set up private package registry for buildscodeartifact.md
Configure deployment strategy (blue/green, canary)codedeploy.md
Cross-account or cross-region deploymentcodepipeline.md
Fix failing pipeline, build, or deploymenttroubleshooting.md

Common Workflows

TaskActionReference
Pipeline from GitHub to ECSCreate connection → CodeBuild Docker stage → CodeDeploy ECS blue/greencodepipeline, codedeploy
Pipeline stuck at sourceCheck connection status; if PENDING, complete OAuth in AWS Consoletroubleshooting
Build timing outCheck VPC/NAT, increase timeoutInMinutes, verify Docker privileged modecodebuild
Deploy to another accountConfigure KMS + S3 bucket policy + cross-account role, add RoleArn to actioncodepipeline
Roll back failed deploymentAuto-rollback on alarm/failure; manual: stop-deployment --auto-rollback-enabledcodedeploy
Lambda canary deploymentCodeBuild packages → CodeDeploy Lambda with canary traffic shiftingcodedeploy

Troubleshooting

Error/SymptomCauseFix
YAML_FILE_ERROR in CodeBuildMissing or malformed runtime-versions in buildspec (recommended for standard images)Add runtime-versions block in install phase
file already exists on CodeDeployRedeployment without overwrite configSet file_exists_behavior: OVERWRITE
Pipeline trigger not firingFile path filter checks only first 100 files in diffReduce path filter scope or merge smaller
PARALLEL mode wrong revisionRace between event and source actionUse QUEUED mode for sequential consistency
Docker: Cannot connect to daemonMissing privileged modeSet privilegedMode: true AND start dockerd in buildspec
CODEBUILD_CLONE_REF permission errorCodeBuild role missing UseConnectionAdd codeconnections:UseConnection to CodeBuild service role
Deployment never completesMinimumHealthyHosts too high for instance countEnsure healthy threshold < total instances
ECS deployment stuckHealth check failing on new task setVerify 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 PLAINTEXT
  • MUST 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 * for s3:GetObject or kms:Decrypt
  • MUST 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

TopicUse instead
CDK Pipelines (aws-cdk-lib/pipelines)aws-cdk
sam deploy / SAM CLIaws-serverless
ECS service deployment config (circuit breaker, rolling params)aws-containers
GitHub Actions / GitLab CIThird-party tools, not covered

aws의 다른 스킬

agents-build
aws
Use to extend an existing agent project with memory, app integration, VPC, multi-agent, migration, model, browser, code interpreter, payments, or resource…
official
agents-connect
aws
Use when connecting your agent to external APIs, tools, or services via Gateway, or restricting tool access with Cedar policies. Handles gateway setup, target…
official
agents-debug
aws
Use when your agent or environment is broken — wrong answers, errors, timeouts, tool failures, or CLI issues. Reads traces and logs to diagnose root causes.…
official
agents-deploy
aws
에이전트를 AWS에 배포할 때 또는 배포가 실패했을 때 사용합니다. 사전 검증, CDK/IAM/할당량 오류 진단, 버전 관리, 롤백 등을 처리합니다.
official
agents-get-started
aws
개발자가 새 에이전트 프로젝트를 만들거나 AgentCore를 시작하려 할 때 사용합니다. 프레임워크 선택, 프로젝트 스캐폴딩, 첫 배포 등을 처리합니다.
official
agents-harden
aws
Use when preparing your agent for production — IAM scoping, inbound auth (JWT, SigV4), secrets management, cold start optimization, session lifecycle, rate…
official
agents-pay
aws
런타임에 x402로 보호된 콘텐츠에 대해 이 에이전트가 비용을 지불해야 할 때 사용: 작업 중 페이월을 만나면 AgentCore Payments를 통해 결제를 처리하고 적용하는 경우…
official
amazon-aurora-mysql
aws
Amazon Aurora MySQL — Aurora MySQL 클러스터를 구체적으로 생성, 수정, 조언합니다(MySQL 호환 엔진, Aurora serverless, 병렬 쿼리).…
official