Demo: Creating Dynamic Builds Using Environment Variables
Understand how to use environment variables to make our build dynamic.
A task commonly performed in the pre-build phase of the build specification is to log in to the services that the delivery pipeline will use in the subsequent build phase. However, AWS strongly recommends not providing the user credentials or the access keys as part of the build specification file. How can we solve this issue?
The value proposition of environment variables
We can solve it using environment variables. Hardcoding variable values is not recommended in the IT industry. Fetching the values at runtime is a good practice to avoid tight coupling.
Enhancements to build specification file
The following YAML file shows the enhanced version of the buildspec
file. We add a new environment variable, VARIABLE1
, and assign it a value. The environment variable must be included as part of the env
section.
Get hands-on with 1200+ tech skills courses.