DEV Community

Fazly Fathhy
Fazly Fathhy

Posted on

Create a buildspec.yaml file for aws build

1.version: Specifies the buildspec version.
2.env: Defines environment variables.
3.phases: Contains instructions for the build lifecycle.
4.artifacts: Specifies the output files to be stored.
5.cache: Defines caching to speed up builds (optional).

ex :

version: 0.2

env:
variables:
ENV_VAR_NAME: "value" # Custom environment variable
parameter-store:
SECRET_KEY: "/my/secret/key" # Parameter Store variable

phases:
install:
runtime-versions:
nodejs: 16 # Specify runtime versions
commands:
- echo "Installing dependencies..."
- npm install # Example for Node.js projects

pre_build:
commands:
- echo "Running pre-build steps..."
- npm test # Example for running tests

build:
commands:
- echo "Building the project..."
- npm run build # Example for building a Node.js project

post_build:
commands:
- echo "Post-build steps..."
- echo "Build completed on date"

artifacts:
files:
- "*/" # Include all files
discard-paths: no
base-directory: build # Directory containing build output

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more