기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
Amazon S3 버킷에 객체 업로드
로컬 파일 시스템의 파일을 Amazon S3 버킷에 객체로 업로드하려면 Write-S3Object
cmdlet을 사용합니다. 아래 예제에서는 간단한 HTML 파일 두 개를 작성하여 Amazon S3 버킷에 업로드하고 업로드된 객체의 유무를 확인합니다. -File
에 대한 Write-S3Object
파라미터는 로컬 파일 시스템의 파일 이름을 지정합니다. -Key
파라미터는 Amazon S3에서 해당 객체에 사용될 이름을 지정합니다.
Amazon은 파일 확장명에서 객체의 콘텐츠 유형(이 경우 ".html")을 유추합니다.
PS >
# Create the two files using here-strings and the Set-Content cmdlet
PS >
$index_html = @"
>>
<html>
>>
<body>
>>
<p>
>>
Hello, World!
>>
</p>
>>
</body>
>>
</html>
>>
"@
>>
PS >
$index_html | Set-Content index.html
PS >
$error_html = @"
>>
<html>
>>
<body>
>>
<p>
>>
This is an error page.
>>
</p>
>>
</body>
>>
</html>
>>
"@
>>
>>
$error_html | Set-Content error.html
>>
# Upload the files to Amazon S3 using a foreach loop
>>
foreach ($f in "index.html", "error.html") {
>>
Write-S3Object -BucketName website-example -File $f -Key $f -CannedACLName public-read
>>
}
>>
PS >
# Verify that the files were uploaded
PS >
Get-S3BucketWebsite -BucketName website-example
IndexDocumentSuffix ErrorDocument ------------------- ------------- index.html error.html
미리 준비된 ACL 옵션
Tools for Windows PowerShell을 사용하여 미리 준비된 ACL을 지정하는 값은 AWS SDK for .NET에서 사용되는 것과 동일합니다. 하지만 이러한 값은 Amazon S3 Put Object
작업에 사용되는 값과는 다릅니다. Tools for Windows PowerShell은 다음과 같은 미리 준비된 ACL을 지원합니다.
-
NoACL
-
private
-
public-read
-
public-read-write
-
aws-exec-read
-
authenticated-read
-
bucket-owner-read
-
bucket-owner-full-control
-
log-delivery-write
미리 준비된 ACL 설정에 대한 자세한 내용은 액세스 제어 목록 개요를 참조하십시오.
멀티파트 업로드에 관한 정보
Amazon S3 API를 사용하여 5GB보다 큰 파일을 업로드하는 경우 멀티파트 업로드를 사용해야 합니다. 하지만 Tools for Windows PowerShell에서 제공하는 Write-S3Object
cmdlet은 5GB보다 큰 파일 업로드를 투명하게 처리할 수 있습니다.
웹 사이트 테스트
이때 브라우저에서 탐색하여 웹 사이트를 테스트할 수 있습니다. Amazon S3에 호스팅된 정적 웹 사이트의 URL은 표준 형식을 따릅니다.
http://<bucket-name>.s3-website-<region>.amazonaws.com
예:
http://website-example.s3-website-us-west-1.amazonaws.com