Cloud Infra Architecture (AWS)/AWS Build
AWS upload failed: 2 An error occurred (AccessDenied) when calling the CreateMultipartUpload operation: Access Denied
seongduck
2025. 2. 11. 17:46
upload failed: 2 An error occurred (AccessDenied) when calling the CreateMultipartUpload operation: Access Denied
해당 장애는 S3 Bucket에 올릴 때 vmimport의 정책이 없을 때 발생합니다.
해결방안
vmimport role이 없을 때 (S3 접근 권한이 없을 때)
AWS S3에 업로드하거나 S3에 올려진 리소스를 통해 AWS 자원을 만들 때 vmimport role이 필요합니다.
1-1) vmimport 라는 Role을 생성하고, 적용할 Policy 생성
S3의 Raw Data를 이용해서 EBS Snapshot을 생성하려면 vmimport role이 필요합니다.
1) IAM -> Policy -> 생성
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::S3_버킷명",
"arn:aws:s3:::S3_버킷명/해당버킷_폴더명/*"
]
},
{
"Effect": "Allow",
"Action": [
"ec2:ImportImage",
"ec2:DescribeImportImageTasks",
"ec2:CancelImportTask",
"s3:GetObject"
],
"Resource": "arn:aws:s3:::S3_버킷명/해당버킷_폴더명/*"
},
{
"Effect": "Allow",
"Action": [
"ec2:ModifySnapshotAttribute",
"ec2:CopySnapshot",
"ec2:RegisterImage",
"ec2:Describe*"
],
"Resource": "*"
}
]
}
1-2) vmimport Role 생성
1) IAM -> Role 생성
2) 신뢰할 수 있는 엔터티 선택
- AWS 서비스
- 사용 사례 : EC2
3) 권한 추가
- 위에서 만든 Policy 선택
4) 이름 지정
- vmimport
1-3) vmimport Role에 신뢰 정책 부여
1) 방금 만든 IAM Role 선택
2) 신뢰 관계 -> 편집
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "vmie.amazonaws.com"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:ExternalId": "vmimport"
}
}
}
]
}
vmimport role 생성 완료
1-4) 작업하는 서버 재부팅
sudo reboot
다시 명령어를 입력해보면 정상적으로 작동 됩니다.
aws s3 cp ./파일명 s3://본인_S3_버킷명/버킷폴더/