S3의 보안을 여러가지로 설정할 수 있는데 그 중 하나가 S3 버킷 정책을 적어놓는것.
자세한 사항은 아래
docs.aws.amazon.com/AmazonS3/latest/userguide/access-policy-language-overview.html
Policies and Permissions in Amazon S3 - Amazon Simple Storage Service
Thanks for letting us know this page needs work. We're sorry we let you down. If you've got a moment, please tell us how we can make the documentation better.
docs.aws.amazon.com
아래로 들어가면 편집을 할 수 있고 쉽게 만들 수 있도록 정책 생성기도 제공해준다.
버킷 선택 > 권한 > 버킷정책 > 편집
정책생성에 대한 각 설명도 제공한다.
docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html
IAM JSON policy elements reference - AWS Identity and Access Management
Thanks for letting us know this page needs work. We're sorry we let you down. If you've got a moment, please tell us how we can make the documentation better.
docs.aws.amazon.com
조금 대략적으로 적어본다면
Effect - 접근하는 사람을 선택할 것인가 안선택할것인가
Allow - 모두 허용
Deny - 선택해서 받음
Principal - 접근할 수 있는 사람
* - 모두
접근할 수 있는 사람 명시 - 그 사람만
docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html
AWS JSON policy elements: Principal - AWS Identity and Access Management
If your Principal element in a role trust policy contains an ARN that points to a specific IAM user, then that ARN is transformed to the user's unique principal ID when the policy is saved. This helps mitigate the risk of someone escalating their privilege
docs.aws.amazon.com
Amazon Resource Name (ARN) - 접근하고자 하는 S3의 버킷 ARN/경로
generate policy 를 클릭하면 정책을 만들어 준다.
예시
{
"Id": "Policy",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt",
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::bucket/*",
"Principal": "*"
},
{
"Sid": "Stmt1620641210263",
"Action": [
"s3:PutObject"
],
"Effect": "Deny",
"Resource": "arn:aws:s3:::bucket/*",
"Principal": {
"AWS": [
"arn:aws:iam::"
]
}
}
]
}
Bucket policy examples - Amazon Simple Storage Service
When testing permissions using the Amazon S3 console, you will need to grant additional permissions that the console requires—s3:ListAllMyBuckets, s3:GetBucketLocation, and s3:ListBucket permissions. For an example walkthrough that grants permissions to
docs.aws.amazon.com
aws.amazon.com/ko/premiumsupport/knowledge-center/s3-access-denied-error/
S3 객체에 대한 링크를 열 때 발생하는 403 오류 문제 해결
Amazon Simple Storage Service(Amazon S3)의 객체에 액세스할 수 있는 권한이 있습니다. 하지만 객체에 대해 Amazon S3 콘솔에서 제공한 HTTPS 링크를 열때 액세스 거부 오류 메시지를 받습니다. 해결하려면 어
aws.amazon.com
https 접속
ERROR
1. Action does not apply to any resource(s) in statement
resource의 경로를 지정해주지 않아서 그렇다.
예를들어 bucket의 arn 이 arn:aws:s3:::bucket이라고 하였을 경우 버킷 전체에 접근이 가능하다면
arn:aws:s3:::bucket/*
폴더를 지정하려면
arn:aws:s3:::bucket/readOnlyFolder/*
등으로 지정해 주어야한다.
stackoverflow.com/questions/44228422/s3-bucket-action-doesnt-apply-to-any-resources
S3 Bucket action doesn't apply to any resources
I'm following the instructions from this answer to generate the follow S3 bucket policy: { "Id": "Policy1495981680273", "Version": "2012-10-17", "Statement": [ { "Sid": "
stackoverflow.com
docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html#Action
IAM JSON policy elements reference - AWS Identity and Access Management
Thanks for letting us know this page needs work. We're sorry we let you down. If you've got a moment, please tell us how we can make the documentation better.
docs.aws.amazon.com
3가지 종류의 S3 bucket policy
mystria.github.io/archivers/3ways-to-set-s3-bucket-policy
3가지 종류의 S3 bucket policy « Personal Tech Note
Amazon S3에서 IAM사용자(User 또는 Role)의 접근을 제어할 수 있는 bucket policy S3에서 “특정한 사용자 외엔 접근불가”라는 규칙을 적용하고 싶다! 3가지 방법 사실 크게 2가지 방법으로 나눌 수 있다.
mystria.github.io
docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html
IAM JSON policy elements: Condition - AWS Identity and Access Management
IAM JSON policy elements: Condition The Condition element (or Condition block) lets you specify conditions for when a policy is in effect. The Condition element is optional. In the Condition element, you build expressions in which you use condition operato
docs.aws.amazon.com
'프로젝트 설정 > AWS|GCP' 카테고리의 다른 글
[AWS] EC2 용량 증설 (feat. No space left on device) (0) | 2022.01.12 |
---|---|
[AWS] Amazon Linux 2 AMI 에서 apt-get 이 실행되지 않을 경우 (0) | 2021.11.17 |
[AWS] ROUTE 53 도메인 연결 (EC2 연결) (0) | 2021.04.13 |
[AWS][ubuntu] python 설치 (flask install) (0) | 2021.04.05 |
[AWS] ubuntu 업데이트 (0) | 2021.04.05 |