| name | aws-codebuild |
| description | CodeBuild via AWS CLI v2 (`aws codebuild`). Projects, builds, build batches, report groups, source credentials, webhooks, fleets. |
AWS CLI v2 — CodeBuild
Overview
Complete reference for all aws codebuild subcommands in AWS CLI v2. Covers build project management, build execution, build batches, report groups, reports, source credentials, webhooks, compute fleets, and resource tagging.
Quick Reference — Common Workflows
Create a build project
aws codebuild create-project --name my-project \
--source type=CODECOMMIT,location=https://git-codecommit.us-east-1.amazonaws.com/v1/repos/my-repo \
--artifacts type=S3,location=my-bucket,path=builds \
--environment type=LINUX_CONTAINER,computeType=BUILD_GENERAL1_SMALL,image=aws/codebuild/amazonlinux2-x86_64-standard:4.0 \
--service-role arn:aws:iam::123456789012:role/codebuild-role
Start a build
aws codebuild start-build --project-name my-project
Start a build with overrides
aws codebuild start-build --project-name my-project \
--source-version main \
--environment-variables-override name=ENV_VAR,value=my-value,type=PLAINTEXT
List builds for a project
aws codebuild list-builds-for-project --project-name my-project \
--sort-order DESCENDING --query 'ids[0:5]'
Get build details
aws codebuild batch-get-builds --ids my-project:build-id
Stop a running build
aws codebuild stop-build --id my-project:build-id
Import source credentials (GitHub PAT)
aws codebuild import-source-credentials \
--server-type GITHUB \
--auth-type PERSONAL_ACCESS_TOKEN \
--token my-pat-token
Create a webhook for automatic builds
aws codebuild create-webhook --project-name my-project \
--filter-groups '[[{"type":"EVENT","pattern":"PUSH"},{"type":"HEAD_REF","pattern":"^refs/heads/main$"}]]'
Start a build batch
aws codebuild start-build-batch --project-name my-project \
--buildspec-override file://buildspec-batch.yml
Command Reference
See index.md for the quick reference table and global options.
| Group | File | Commands |
|---|
| Projects | projects.md | create-project, delete-project, batch-get-projects, list-projects, update-project |
| Builds | builds.md | start-build, stop-build, retry-build, batch-get-builds, list-builds, list-builds-for-project |
| Build Batches | build-batches.md | start-build-batch, stop-build-batch, retry-build-batch, delete-build-batch, describe-build-batches (batch-get-build-batches), list-build-batches, list-build-batches-for-project |
| Report Groups | report-groups.md | create-report-group, delete-report-group, batch-get-report-groups, list-report-groups, update-report-group |
| Reports | reports.md | batch-get-reports, delete-report, describe-test-cases, list-reports, list-reports-for-report-group |
| Source Credentials | source-credentials.md | import-source-credentials, delete-source-credentials, list-source-credentials |
| Webhooks | webhooks.md | create-webhook, delete-webhook, update-webhook |
| Fleets | fleets.md | create-fleet, delete-fleet, batch-get-fleets, list-fleets, update-fleet |
| Tags | tags.md | tag-resource (codebuild), untag-resource (codebuild), list-tags-for-resource (codebuild, via batch-get) |