aws sdk를 사용하여 pre-signed url 생성하는 방법
- 이전글 참고
2023.10.12 - [Kotlin] - pre-signed url 사용하기, 일정 기간 동안 객체 다운로드 url 생성
pre-signed url 사용하기, 일정 기간 동안 객체 다운로드 url 생성
https://docs.aws.amazon.com/AmazonS3/latest/userguide/example_s3_Scenario_PresignedUrl_section.html Create a presigned URL for Amazon S3 using an AWS SDK - Amazon Simple Storage Service This documentation is for an SDK in preview release. The SDK is subjec
eggwhite0.tistory.com
- AWS 문서
https://docs.aws.amazon.com/ko_kr/sdk-for-php/v3/developer-guide/s3-presigned-url.html
Amazon S3 사전 서명된 URL (AWS SDK for PHP버전 3 포함) - AWS SDK for PHP
이 메서드에 의해 반환되는 URL은 버킷 또는 키가 존재하는지 검증되지 않았으며, 이 메서드는 객체가 무단 액세스를 허용하는지 여부를 확인하지 않습니다.
docs.aws.amazon.com
위 문서를 참고하여 30분 동안 유효한 서명된 URL을 만들 수 있었다
try{
$s3Client = new S3Client(array(
'region' => 'ap-northeast-2',
'version' => 'latest',
'http' => array('verify' => false),
'credentials' => array('key' => 'BucketKey',
'secret' => 'BucketSecretKey')
));
//Creating a presigned URL
$cmd = $s3Client->getCommand('GetObject', array(
'Bucket' => 'my-bucket',
'Key' => '파일이름'
));
$request = $s3Client->createPresignedRequest($cmd, '+30 minutes');
// Get the actual presigned-url
$presignedUrl = (string)$request->getUri();
}catch (Exception $e){
}
반응형
'기타 프로그램' 카테고리의 다른 글
[Spring Boot] jar 파일 만들고 실행, 프로파일 설정 (0) | 2024.03.25 |
---|---|
nginx 에러로그 실시간 확인 하는 명령 (1) | 2024.01.25 |
PHP AWS S3 파일 업로드 하기 (0) | 2023.08.25 |
PHP trim(), preg_replace() 문자열 공백 제거 (0) | 2023.02.28 |
querydsl 문자열 더하기 (0) | 2022.10.05 |
댓글