728x90
반응형
aws s3 mb s3://버킷(유일한 이름) --region ap-northeast-2
앞서 Public S3를 배포하고 사용해보았다.
https://asdfmelody.tistory.com/14
이번에는 Private S3 실습이다
CLI로 S3 버킷 생성
aws s3 mb s3://버킷(유일한 이름) --region ap-northeast-2
CLI로 버킷 생성
아마존 웹페이지에서도 잘 생성된 것을 확인 할 수 있다.
# 버킷 이름을 변수에 지정
[root@EC2-STG2 ~]# MyS3=버킷이름 # 로컬 파일을 S3로 업로드
[root@EC2-STG2 ~]# echo "111" > /var/www/html/111.txt
[root@EC2-STG2 ~]# aws s3 cp /var/www/html/111.txt s3://$MyS3
upload: ../var/www/html/111.txt to s3://gosum-s3123/111.txt
[root@EC2-STG2 ~]# aws s3 ls s3://$MyS3
2021-07-03 19:54:59 4 111.txt
# 트리구조 확인
[root@EC2-STG2 ~]# tree /var/www/html /var/www/html
├── 111.txt
├── efs
│ └── index.html
└── index.html
1 directory, 3 files
# 웹 디렉터리(하위 포함)을 버킷에 업로드(백업)하기
[root@EC2-STG2 ~]# aws s3 sync --delete /var/www/html s3://$MyS3
upload: ../var/www/html/index.html to s3://gosum-s3123/index.html
upload: ../var/www/html/efs/index.html to s3://gosum-s3123/efs/index.html
[root@EC2-STG2 ~]# aws s3 ls s3://$MyS3 --recursive
2021-07-03 19:54:59 4 111.txt
2021-07-03 19:57:45 44 efs/index.html
2021-07-03 19:57:45 129 index.html
파일 업로드/백업 된 것 확인
이번 주차 실습은 여기서 끝
자원 삭제는 필수!
https://asdfmelody.tistory.com/16
728x90
반응형
'클라우드' 카테고리의 다른 글
[AWS] AWS를 통해 외부 DB 접속하기 (0) | 2022.02.17 |
---|---|
[AFOS 2기 4주차] AWS 스토리지 서비스 배포하고 사용하기 - 5 (자원 삭제) (0) | 2021.07.06 |
[AFOS 2기 4주차] AWS 스토리지 서비스 배포하고 사용하기 - 3 (Public S3) (1) | 2021.07.06 |
[AFOS 2기 4주차] AWS 스토리지 서비스 배포하고 사용하기 - 2 (EFS) (0) | 2021.07.05 |
[AFOS 2기 4주차] AWS 스토리지 서비스 배포하고 사용하기 - 1 (EBS 생성 및 파티션 확장) (0) | 2021.07.04 |