Comparing AWS and GCP Storage Buckets: A CLI Command Guide
A quick comparison of commands for actions to manage storage buckets in AWS and GCP

A fledgling engineer dabbling into areas of DevOps, AWS and automation. I enjoy tinkering with technology frameworks and tools to understand and gain visibility in the underlying mechanisms of the "magic" in them.
In the progress of accumulating nuggets of wisdom in the different software engineering disciplines!
Overview
Compared to AWS management console, I find GCP's management console to be quite overwhelming. By using the command-line interface gcloud, it helped me to focus and map familiar features found in S3 to Google Storage's Cloud Bucket.
AWS's command-line interface aws for S3 have 2 sets of command
aws s3apiconsists of all the low-level operations for the full suite of available actionsaws s3is a wrapper for all the common functions to manage the buckets
Prerequisites
You will need to configure the aws and gcloud command with the required authentication before running the commands listed below
# AWS - Guided to provided the
# 1. AWS_ACCESS_KEY_ID
# 2. AWS_SECRET_ACCESS_KEY
aws configure
# GCP - Guided to use SSO login
gcloud auth application-default login
CRUD Operations
Below are a list of actions to manage the buckets in the respective cloud providers, AWS and GCP respectively.
Create new bucket
To start off, replace the value of BUCKET_NAME value to the desired bucket name
# Common variables
BUCKET_NAME="REPLACE_WITH_BUCKET_NAME"
# AWS
aws s3api create-bucket --bucket "$BUCKET_NAME" --region ap-southeast-1 --create-bucket-configuration LocationConstraint=ap-southeast-1
# GCP
gcloud storage buckets create "gs://$BUCKET_NAME" --location="asia"
List all buckets
# AWS
aws s3 ls
# GCP
## By providing the --format option, will only list the bucket names, else other metadata will be provided
gcloud storage buckets list [--format="json(name)"]
List bucket's objects
# AWS
aws s3 ls s3://BUCKET_NAME/
# GCP
gcloud storage ls gs://BUCKET_NAME/
Upload new object
# AWS
aws s3 cp LOCAL_FILENAME s3://BUCKET_NAME/REMOTE_FILENAME
# GCP
gcloud storage cp LOCAL_FILENAME gs://BUCKET_NAME/REMOTE_FILENAME
Delete object from bucket
# AWS
aws s3 rm s3://BUCKET_NAME/REMOTE_FILENAME
# GCP
gcloud storage rm gs://BUCKET_NAME/REMOTE_FILENAME
![[DH] Keeping an organised inventory of annotated screenshots](/_next/image?url=https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1731688657857%2Fcaeeeb6f-1530-4c88-a820-d22deaf0391e.png&w=3840&q=75)


