Question:
The Nautilus DevOps team is responsible for managing and deploying applications efficiently. They want to streamline their CI/CD process using AWS CodePipeline and AWS S3. Your task is to set up a CI/CD pipeline that automates the deployment of a sample web application on an S3 bucket configured as a static website.
For this task, perform the following steps:
There is a bucket named datacenter-source-2769 which contains a static website source code. Create a new S3 bucket named datacenter-deployment-25648. Configure the bucket to serve static website content and ensure the bucket is publicly accessible.
Create an AWS CodePipeline named datacenter-webapp-pipeline with the following stages:
Source: Source Provider - AWS S3, Bucket Name - datacenter-source-2769.
Build: Build Provider - AWS CodeBuild, Project Name - datacenter-build-project, Environment - Managed image, aws/codebuild/amazonlinux2-x86_64-standard:4.0, Linux, and set the Image version to Always use the latest image for this runtime version. Insert the necessary build commands in the Build commands section to directly upload the index.html file to the S3 bucket.
================================================
Logs:
[Container] 2025/06/24 18:07:37.736900 Running on CodeBuild On-demand
[Container] 2025/06/24 18:07:37.736911 Waiting for agent ping
[Container] 2025/06/24 18:07:37.838038 Waiting for DOWNLOAD_SOURCE
[Container] 2025/06/24 18:07:39.000960 Phase is DOWNLOAD_SOURCE
[Container] 2025/06/24 18:07:39.001854 CODEBUILD_SRC_DIR=/codebuild/output/src2006437624/src
[Container] 2025/06/24 18:07:39.002346 YAML location is /codebuild/readonly/buildspec.yml
[Container] 2025/06/24 18:07:39.004182 Setting HTTP client timeout to higher timeout for S3 source
[Container] 2025/06/24 18:07:39.004283 Processing environment variables
[Container] 2025/06/24 18:07:39.159263 No runtime version selected in buildspec.
[Container] 2025/06/24 18:07:39.179998 Moving to directory /codebuild/output/src2006437624/src
[Container] 2025/06/24 18:07:39.180016 Cache is not defined in the buildspec
[Container] 2025/06/24 18:07:39.216749 Skip cache due to: no paths specified to be cached
[Container] 2025/06/24 18:07:39.216994 Registering with agent
[Container] 2025/06/24 18:07:39.250838 Phases found in YAML: 1
[Container] 2025/06/24 18:07:39.250855 BUILD: 3 commands
[Container] 2025/06/24 18:07:39.251082 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED
[Container] 2025/06/24 18:07:39.251102 Phase context status code: Message:
[Container] 2025/06/24 18:07:39.319257 Entering phase INSTALL
[Container] 2025/06/24 18:07:39.354420 Phase complete: INSTALL State: SUCCEEDED
[Container] 2025/06/24 18:07:39.354433 Phase context status code: Message:
[Container] 2025/06/24 18:07:39.391592 Entering phase PRE_BUILD
[Container] 2025/06/24 18:07:39.392884 Phase complete: PRE_BUILD State: SUCCEEDED
[Container] 2025/06/24 18:07:39.392896 Phase context status code: Message:
[Container] 2025/06/24 18:07:39.425386 Entering phase BUILD
[Container] 2025/06/24 18:07:39.457432 Running command echo “Deploying index.html to S3”
Deploying index.html to S3
[Container] 2025/06/24 18:07:39.462219 Running command ls -R
.:
2hDZKAV.html
[Container] 2025/06/24 18:07:39.499163 Running command aws s3 cp index.html s3://datacenter-deployment-25648/index.html
The user-provided path index.html does not exist.
[Container] 2025/06/24 18:07:53.292872 Command did not exit successfully aws s3 cp index.html s3://datacenter-deployment-25648/index.html exit status 255
[Container] 2025/06/24 18:07:53.297510 Phase complete: BUILD State: FAILED
[Container] 2025/06/24 18:07:53.297527 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: aws s3 cp index.html s3://datacenter-deployment-25648/index.html. Reason: exit status 255
[Container] 2025/06/24 18:07:53.340988 Entering phase POST_BUILD
[Container] 2025/06/24 18:07:53.342574 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2025/06/24 18:07:53.342588 Phase context status code: Message:
[Container] 2025/06/24 18:07:53.389095 Set report auto-discover timeout to 5 seconds
[Container] 2025/06/24 18:07:53.389159 Expanding base directory path: .
[Container] 2025/06/24 18:07:53.391974 Assembling file list
[Container] 2025/06/24 18:07:53.391987 Expanding .
[Container] 2025/06/24 18:07:53.394755 Expanding file paths for base directory .
[Container] 2025/06/24 18:07:53.394769 Assembling file list
[Container] 2025/06/24 18:07:53.394772 Expanding */
[Container] 2025/06/24 18:07:53.397610 No matching auto-discover report paths found
[Container] 2025/06/24 18:07:53.397640 Report auto-discover file discovery took 0.008544 seconds
[Container] 2025/06/24 18:07:53.397662 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED
[Container] 2025/06/24 18:07:53.397671 Phase context status code: Message:
====================================================
buildspec.yml
version: 0.2
phases:
build:
commands:
- echo “Deploying index.html to S3”
- ls -R
- aws s3 cp index.html s3://datacenter-deployment-25648/index.html
=================================================
I’ve verified the source under code build and pipeline is correct . Codepipeline is fetching a random file name when pipeline runs. I am not able to figure out, what i am doing wrong here.