Introduction
Your portfolio needs a place to store its artwork and project list. Create private Amazon S3 storage, upload those materials and retrieve a copy to confirm the stored content.
Complete the first three portfolio labs first. This fresh environment supplies its own running website and local materials. You will prepare storage here; the next lab will connect a website to private S3 images through an EC2 role.
Certification Relevance
| Certification | Exam task | Practice |
|---|---|---|
| AWS Certified Cloud Practitioner (CLF-C02) | Task 3.6 | Use S3 object storage for application materials, separate from EC2 compute. |
Lab Overview

Create Private Portfolio Storage
In this step, you will create one S3 bucket and explicitly block public access.
EC2 runs your website application. Amazon S3 stores files as objects inside buckets. Separating stored materials from compute lets an application access the same materials without keeping the only copy on its server.
Start in the prepared project directory and load this fresh lab's identifiers:
cd /home/labex/project
source website.env
echo "$PORTFOLIO_BUCKET"
PORTFOLIO_BUCKET is a unique bucket name supplied for your task; the bucket does not exist yet. Bucket names must be globally unique within an AWS partition. Use this name rather than a common name such as portfolio.
The AWS CLI's s3 commands provide convenient file operations. mb means make bucket; the s3:// prefix identifies an S3 location:
aws s3 mb "s3://$PORTFOLIO_BUCKET"
You should see a make_bucket confirmation. Your prepared connection uses us-east-1, so the new bucket is in that Region.
New S3 storage is private by default. Block Public Access adds settings that prevent public ACLs or policies from accidentally opening the bucket. Inspect the supplied four-setting configuration:
cat private-access.json
Each true enables a protection. Apply the whole configuration with the lower-level s3api operation:
aws s3api put-public-access-block --bucket "$PORTFOLIO_BUCKET" --public-access-block-configuration file://private-access.json
Read it back:
aws s3api get-public-access-block --bucket "$PORTFOLIO_BUCKET"
Confirm all four values are true. In AWS View, find your new S3 bucket with No objects. Leave the separate reference bucket unchanged; it contains unrelated data.
Upload and Retrieve Your Design Assets
In this step, you will store the designer website's three project covers and project list, then retrieve an exact cover copy.
The supplied portfolio-assets/ directory contains four files:
| File | Website use |
|---|---|
images/aura-brand.webp |
The large AURA skincare-brand cover |
images/forma-chair.webp |
The blue FORMA furniture cover |
images/echo-record.webp |
The ECHO music-identity cover |
projects.json |
Project titles, descriptions and image references used by the detail panels |
WebP is an image format used on websites. The artwork, site code, font and compiled Tailwind CSS are supplied; you do not need to design images, install Tailwind or write application code.
An object's key is its name within a bucket. images/aura-brand.webp is a key with an images/ prefix; S3 does not require a real folder for that prefix. cp means copy. --recursive copies all files inside the local directory, preserving their relative paths as object keys:
aws s3 cp portfolio-assets/ "s3://$PORTFOLIO_BUCKET/" --recursive
Expect four upload lines. Inspect the remote objects:
aws s3api list-objects-v2 --bucket "$PORTFOLIO_BUCKET"
Look inside Contents for exactly the four keys listed above. AWS View should show the same object names. Sizes and timestamps can vary.

Reverse the copy direction to download the AURA cover under a different local filename:
aws s3 cp "s3://$PORTFOLIO_BUCKET/images/aura-brand.webp" downloaded-aura.webp
Compare the original and downloaded files. cmp compares bytes and produces no output when the files are identical:
cmp portfolio-assets/images/aura-brand.webp downloaded-aura.webp
No output and a returned prompt mean the stored cover was retrieved unchanged. If they differ, check the key and upload the supplied original again.
The website still uses its supplied local images and project list. You have completed private storage; the next lab gives the application permission to read these S3 objects. This lab does not make the bucket public.
Remove Only Your Portfolio Storage
In this step, you will remove your four uploaded objects, empty bucket and disposable server while preserving unrelated data.
Use only this lab's PORTFOLIO_BUCKET, whose four keys you just inspected. With rm, --recursive removes all objects in this owned bucket. Do not substitute the reference bucket name:
aws s3 rm "s3://$PORTFOLIO_BUCKET/" --recursive
Expect four delete lines. rb removes an empty bucket:
aws s3 rb "s3://$PORTFOLIO_BUCKET"
Display the server identifier before deleting it:
echo "$INSTANCE_ID"
Terminate that server:
aws ec2 terminate-instances --instance-ids "$INSTANCE_ID"
Wait for the final state:
aws ec2 wait instance-terminated --instance-ids "$INSTANCE_ID"
In AWS View, your bucket should be gone and your instance should show terminated. The reference bucket and its keep.txt must remain. Leave the prepared network intact. The next lab supplies its own independent storage and website.
Summary
You created an S3 bucket, blocked public access, stored portfolio artwork and a project list, and confirmed the downloaded artwork matched the original. You distinguished storage from compute and cleaned up only the designated objects, bucket and website server.
Official references: S3 objects, AWS CLI S3 file commands, and Block Public Access.



