CodeDeploy AppSpec File Mapping Rules
Short answer
B The config.txt file will be deployed to /usr/local/src/config.txt and to /var/www/html/config/config.txt.
Question
- 
Key Takeaways
The key insight is that CodeDeploy processes all defined file mappings in order, meaning a specific file can be deployed to multiple locations if it matches multiple mapping rules.
This question tests understanding of AWS CodeDeploy appspec.yml file mapping rules and how multiple entries are processed to determine deployment destinations.
Common mistake: Many learners incorrectly assume that the first matching rule stops further processing or that overlapping paths result in only one destination, leading them to choose option A or C.
Expert Analysis
Why the Answer Is Correct
The correct answer is B because AWS CodeDeploy processes each entry in the 'files' section of the appspec.yml independently. The first mapping explicitly copies config/config.txt to /usr/local/src/config.txt. The second mapping copies the entire root directory (/) to /var/www/html, which inherently includes the config/config.txt file at /var/www/html/config/config.txt. Since both rules apply to the target file, it is deployed to both locations.
Why the Other Options Are Wrong
Option A is incorrect because it ignores the second mapping rule that copies the entire repository root. Option C is incorrect because it ignores the specific first mapping rule. Option D is incorrect because there is no mapping rule directing files to /var/www/html/application/web/, and the second rule maps to /var/www/html, not a subdirectory named application/web.
Community Comment Notes
Community consensus strongly supports option B. As user jamesf noted, "The config/config.txt file will be copied to /usr/local/src/config.txt based on the first mapping. Since the entire source directory (/) is also mapped to /var/www/html, config/config.txt will also be copied to /var/www/html/config/config.txt." Similarly, Moumita explained that the second entry copies the entire contents, including the config file, to the specified HTML directory.
Exam Strategy
When analyzing CodeDeploy appspec.yml files, always check every mapping rule for potential overlaps. Remember that specific file mappings do not prevent broader directory mappings from also applying to those same files.
Frequently Asked Questions
Does CodeDeploy stop processing file mappings after the first match?
How does the root directory mapping affect specific files?
Community Votes
100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 3 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 3
-
Moumita 👍 4 Answered BFirst Entry: source: config/config.txt destination: /usr/local/src/config.txt This rule specifically copies the config/config.txt file from the source repository to /usr/local/src/config.txt on the EC2 instance. Second Entry: source: / destination: /var/www/html This rule copies the entire contents of the root directory of the repository to /var/www/html on the EC2 instance. This includes the config/config.txt file, so it will be copied to /var/www/html/config/config.txt. Given these two rules: The config/config.txt file will be copied to /usr/local/src/config.txt by the first rule. The same file will also be copied to /var/www/html/config/config.txt due to the second rule. So, the correct answer is indeed B. The config.txt file will be deployed to /usr/local/src/config.txt and to /var/www/html/config/config.txt.
-
jamesf 👍 4 Answered BThe config/config.txt file will be copied to /usr/local/src/config.txt based on the first mapping. Since the entire source directory (/) is also mapped to /var/www/html, config/config.txt will also be copied to /var/www/html/config/config.txt.
-
tgv 👍 4 Answered B---> B
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All DOP-C02 Questions
Access 85 questions with complete answers and detailed explanations.
View Full DOP-C02 Practice Test →