put-bucket-website

Prev Next
This content is currently unavailable in Ja - 日本語. You are viewing the default (Korean) version.

Classic/VPC 환경에서 이용 가능합니다.

Ncloud Storage 버킷에 정적 웹 사이트 호스팅 설정을 등록하거나 기존 설정을 덮어씁니다.

참고

Sub Account 사용자가 이 명령어를 실행하려면 Change/PutBucketWebsite 액션 권한이 있어야 합니다.

참고

설정을 등록한 버킷은 http://{bucket}.kr.website.ncloudstorage.com URL로 접근할 수 있습니다. 이 URL은 HTTP와 GET·HEAD·OPTIONS 메서드만 지원하며, 버킷 정책으로 공개한 범위만 응답합니다.

구문

put-bucket-website 구문은 다음과 같습니다.

aws s3api put-bucket-website \
    --bucket <bucket> \
    --website-configuration <website-configuration> \
    [--content-md5 <content-md5>] \
    [--checksum-algorithm <checksum-algorithm>] \
    --endpoint-url <endpoint-url>

옵션

put-bucket-website 실행 시 지정할 수 있는 옵션을 설명합니다.

필수 옵션

put-bucket-website의 필수 옵션입니다.

옵션 타입 필수 여부 설명
--bucket String Required 버킷 이름
--website-configuration String Required 정적 웹 사이트 호스팅 설정
  • 구문 참조
  • 최대 크기: 128KB

--website-configuration 구문

JSON 형식으로 입력하며, 입력할 수 있는 항목은 다음과 같습니다.

항목 타입 필수 여부 설명
IndexDocument.Suffix String Conditional 인덱스 문서의 객체 이름
  • <예시> index.html
  • 빈 문자열 및 / 포함 불가
  • RedirectAllRequestsTo를 입력하지 않은 경우, 필수 입력
ErrorDocument.Key String Optional 오류 문서의 객체 키
  • <예시> error.html
  • 빈 문자열 불가
RedirectAllRequestsTo.HostName String Conditional 모든 요청을 리다이렉트할 호스트 이름
  • IndexDocument를 입력하지 않은 경우, 필수 입력
  • IndexDocument, ErrorDocument, RoutingRules와 동시 입력 불가
RedirectAllRequestsTo.Protocol String Optional 모든 요청을 리다이렉트할 프로토콜
  • http | https
  • 미입력 시 요청 프로토콜을 따름
RoutingRules[].Condition.KeyPrefixEquals String Optional 규칙을 적용할 객체 키의 접두사
  • 최대 1,024자 가능
RoutingRules[].Condition.HttpErrorCodeReturnedEquals String Optional 규칙을 적용할 응답 상태 코드
  • 400~417 | 500~505
RoutingRules[].Redirect.HostName String Optional 리다이렉트할 호스트 이름
  • / 및 공백 포함 불가
RoutingRules[].Redirect.Protocol String Optional 리다이렉트할 프로토콜
  • http | https
RoutingRules[].Redirect.HttpRedirectCode String Optional 리다이렉트 응답 상태 코드
  • 301~308 (306 제외)
  • 미입력 시 301
RoutingRules[].Redirect.ReplaceKeyWith String Optional 객체 키 전체를 대체할 값
  • 최대 1,024자 가능
  • ReplaceKeyPrefixWith와 동시 입력 불가
RoutingRules[].Redirect.ReplaceKeyPrefixWith String Optional Condition.KeyPrefixEquals에 해당하는 접두사를 대체할 값
  • 최대 1,024자 가능
  • ReplaceKeyWith와 동시 입력 불가
  • 예시 1: 인덱스 문서와 오류 문서를 설정할 때
    • docs/ 접두사를 가지는 요청을 documents/로 리다이렉트합니다.
    • 404 오류가 발생하면 https://www.example.com/notfound.html로 리다이렉트합니다.
{
  "IndexDocument": {
    "Suffix": "index.html"
  },
  "ErrorDocument": {
    "Key": "error.html"
  },
  "RoutingRules": [
    {
      "Condition": {
        "KeyPrefixEquals": "docs/"
      },
      "Redirect": {
        "ReplaceKeyPrefixWith": "documents/"
      }
    },
    {
      "Condition": {
        "HttpErrorCodeReturnedEquals": "404"
      },
      "Redirect": {
        "HostName": "www.example.com",
        "Protocol": "https",
        "ReplaceKeyWith": "notfound.html"
      }
    }
  ]
}
  • 예시 2: 모든 요청을 리다이렉트할 때
    • RedirectAllRequestsTo는 다른 항목과 함께 입력할 수 없습니다.
{
  "RedirectAllRequestsTo": {
    "HostName": "www.example.com",
    "Protocol": "https"
  }
}

선택 옵션

put-bucket-website의 선택 옵션입니다. 지정하지 않은 옵션에는 기본값이 적용됩니다.

옵션 타입 필수 여부 설명
--content-md5 String Optional 요청 데이터의 Base64 인코딩된 128비트 MD5 해시값
  • 요청 데이터의 무결성 검증에 사용
  • 미입력 시 자동 계산
--checksum-algorithm String Optional 요청 데이터 검증에 사용할 체크섬 알고리즘
  • CRC32 | CRC32C | SHA1 | SHA256 | CRC64NVME

공통 옵션

aws 명령에서 공통으로 사용하는 옵션에 대한 정보는 Ncloud Storage 옵션을 참조해 주십시오.

예시

정적 웹 사이트 호스팅 설정 요청이 성공하면 설정이 적용되며 결과는 출력되지 않습니다.

명령

명령 예시는 다음과 같습니다.

aws s3api put-bucket-website --bucket my-test-bucket \
    --website-configuration file://website.json \
    --endpoint-url=https://kr.ncloudstorage.com

연관 명령어

연관 명령어는 다음과 같습니다.