본문 바로가기
IT/하려고 하는 클라우드

[GCP]GCP 기초_GCS(Google Cloud Storage)_실습

by Work_Asalia 2021. 9. 8.

1. 버킷 만들기

Cloud Storage -> 브라우저 -> 버킷 만들기 -> 위치 등 설정 후 만들기

2. 객체 업로드 및 다운로드

파일 업로드/폴더 업로드

3. 버킷 및 파일 권한 수정

버킷 선택 -> 상단에 권한 선택 -> 권한 추가 -> 버킷에서 공개된 URL 확인 가능

4. gsutil 명령어

2021.08.24 - [IT/하려고 하는 클라우드] - [GCP] GCP 따라하기_준비

 

[GCP] GCP 따라하기_준비

1. Google 계정 생성 후 로그인  - https://console.cloud.google.com/ Google Cloud Platform 하나의 계정으로 모든 Google 서비스를 Google Cloud Platform을 사용하려면 로그인하세요. accounts.google.com..

spacek82.tistory.com

터미널 연결 -> gsutil 설치 -> gcp 로그인 -> 프로젝트 연결

5. 버킷 확인

버킷 리스트 및 내부 파일 보기

➜  ~ gsutil list
gs://gcs-test0908/
➜  ~ gsutil ls gs://gcs-test0908/
gs://gcs-test0908/accessKeys.csv

버킷 전체 사용량 확인

➜  ~ gsutil du -s  gs://gcs-test0908/
96           gs://gcs-test0908

6. 버킷 만들기 및 삭제

➜  ~ gsutil mb gs://my-second-test
Creating gs://my-second-test/...
➜  ~ gsutil list
gs://gcs-test0908/
gs://my-second-test/
➜  ~ gsutil rb gs://my-second-test
Removing gs://my-second-test/...
➜  ~ gsutil list
gs://gcs-test0908/

7. 버킷에서 파일 다운로드 및 삭제

➜  ~ gsutil cp gs://gcs-test0908/accessKeys.csv .
Copying gs://gcs-test0908/accessKeys.csv...
/ [1 files][   96.0 B/   96.0 B]
Operation completed over 1 objects/96.0 B.
➜  ~ ls -al accessKeys.csv
-rw-r--r--  1 sangnoh.lee  staff  96  9  8 22:00 accessKeys.csv

➜  ~ gsutil ls gs://gcs-test0908/
gs://gcs-test0908/accessKeys.csv
➜  ~ gsutil rm gs://gcs-test0908/accessKeys.csv
Removing gs://gcs-test0908/accessKeys.csv...
/ [1 objects]
Operation completed over 1 objects.
➜  ~ gsutil ls gs://gcs-test0908/

8. 로컬에서 버킷으로 업로드

➜  ~ gsutil mv get-pip.py gs://gcs-test0908/
Copying file://get-pip.py [Content-Type=text/x-python]...
Removing file://get-pip.py...iB]

Operation completed over 1 objects/1.8 MiB.
➜  ~ gsutil ls gs://gcs-test0908/
gs://gcs-test0908/get-pip.py

9. 버킷안에 있는 파일 자세한 정보 보기

➜  ~ gsutil ls -L gs://gcs-test0908/get-pip.py
gs://gcs-test0908/get-pip.py:
    Creation time:          Wed, 08 Sep 2021 13:03:52 GMT
    Update time:            Wed, 08 Sep 2021 13:03:52 GMT
    Storage class:          STANDARD
    Content-Language:       en
    Content-Length:         1868059
    Content-Type:           text/x-python
    Hash (crc32c):          jeT7sA==
    Hash (md5):             J9********pcDVsFD6SYw==
    ETag:                   CPT*****CEAE=
    Generation:             163*****219636
    Metageneration:         1
    ACL:                    []
TOTAL: 1 objects, 1868059 bytes (1.78 MiB)

 

728x90

댓글