# Secure a Public Storage Bucket - gcloud (Solution)

## Overview

* Labs are timed and cannot be paused. The timer starts when you click **Start Lab**.
    
* The included cloud terminal is preconfigured with the gcloud SDK.
    
* Use the terminal to execute commands and then click **Check my progress** to verify your work.
    

## Challenge scenario

* You're a cloud architect for a media company. A critical video archive bucket named `qwiklabs-gcp-00-6372eb9e6b50`\-urgent has mistakenly been made public. Your task is to quickly secure it in the provided time frame.
    

Click **Check my progress** to verify the objective.

Please prevent the public access from your bucket folder and make it private. If already done so, please wait for a while for the changes to get propagated.

Make the media archive folder private.

*Please prevent the public access from your bucket folder and make it private. If already done so, please wait for a while for the changes to get propagated.*

---

## Solution of Lab

%[https://youtu.be/jO8dnodJ2a4] 

```apache
curl -LO raw.githubusercontent.com/ePlus-DEV/storage/refs/heads/main/labs/Secure%20a%20Public%20Storage%20Bucket%20-%20gcloud/lab.sh
source lab.sh
```

**Script Alternative**

```apache
PROJECT_ID=$(gcloud config get-value project)
gsutil iam ch -d allUsers:objectViewer gs://$PROJECT_ID-urgent && gsutil iam get gs://$PROJECT_ID-urgent
```
