Question #733
A developer encounters an error when executing an AWS CodeBuild project because the cumulative size of all environment variables exceeds the maximum allowed limit. What is the best practice to resolve this issue?
Configure the buildspec.yml to set the LCALL environment variable to 'enUS.utf8' in the pre_build phase.
Store the environment variables as encrypted entries in AWS Secrets Manager and reference them in the build project.
Modify the build project to utilize an Amazon EC2 instance with increased storage capacity for environment variables.
Reference the environment variables from AWS Systems Manager Parameter Store within the CodeBuild project.
Explanation
Answer D is correct because AWS Systems Manager Parameter Store allows storing environment variables externally, reducing the cumulative size in CodeBuild. CodeBuild supports direct references to Parameter Store parameters, which count as a single environment variable entry regardless of their size. This avoids hitting the 10 KB limit for all environment variables combined.
Option A is unrelated to variable size limits. Option B uses Secrets Manager, which is ideal for secrets but less efficient for general parameters. Option C is invalid because CodeBuild's environment variable limits are service-specific, not tied to EC2 storage. Parameter Store (D) is the recommended AWS solution for this scenario, offering cost-efficiency and seamless integration with CodeBuild.
Answer
The correct answer is: D