AWS — CodeBuild
What is CodeBuild?
Fully managed build service.
Create project
aws codebuild create-project \
--name my-build \
--service-role arn:aws:iam::123456789:role/codebuild-role \
--artifacts type=NO_ARTIFACTS \
--environment type=LINUX_CONTAINER,computeType=BUILD_GENERAL1_SMALL,image=aws/codebuild/standard:5.0 \
--source type=CODECOMMIT,location=arn:aws:codecommit:us-east-1:123456789:my-repo
Build spec
version: 0.2
phases:
install:
runtime-versions:
python: 3.9
commands:
- pip install -r requirements.txt
build:
commands:
- python -m pytest
- python -m pylint src/
artifacts:
files:
- '**/*'
Start build
aws codebuild start-build --project-name my-build
Environment variables
aws codebuild start-build \
--project-name my-build \
--environment-variables-override name=ENV,value=production,type=PLAINTEXT
Batch builds
aws codebuild start-build-batch \
--project-name my-build \
--build-spec config/build-spec.yml
Best practices
- Cache dependencies
- Use build spec versions
- Set up webhooks
- Monitor build logs
Mini Practice
- Create a build project
- Add build spec
- Run a build
- Set up caching
Up Next
Continue with CodeDeploy - Deployment Service.
Related Topics
Frequently Asked Questions about CodeBuild
What is CodeBuild in AWS?
CodeBuild is a fundamental concept in AWS. This lesson explains it step by step with clear examples, making it easy for beginners to understand.
How do I learn CodeBuild?
Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn CodeBuild.
Why is CodeBuild important in AWS?
CodeBuild is essential for AWS development. Understanding this concept will help you write better code and solve real-world problems more effectively.