Is this possible to set different condition in the Policy on S3 bucket ?

0

we have whitelisted some set of IP's and VPC on S3 bucket so that only whitelisted users can access those objects URL.

But we also want to serve same set of objects through Cloudfront as well.This Cloudfront URL will be used internally only.Can we add them as well ? Any recommendations in the below policy which needs to be set ?

{ "Version": "2012-10-17", "Statement": [ { "Sid": "Statement2", "Effect": "Allow", "Principal": "", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::toch-poc-2/", "Condition": { "ForAnyValue:StringEqualsIfExists": { "aws:SourceVpc": "vpc-01da38acfdde46edd" } } }, { "Sid": "Statement2", "Effect": "Allow", "Principal": "", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::toch-poc-2/", "Condition": { "IpAddress": { "aws:SourceIp": [ "43.204.223.244/32", "34.126.80.246/32", "34.142.191.139/32", "34.143.188.86/32", "49.249.215.66/32", "15.207.175.132/32", "10.190.3.0/24" ] } } } ] }

Dhaval
질문됨 일 년 전255회 조회
2개 답변
0
수락된 답변

Yes, this is possible by using CloudFront Origin Access Control and adding a statement to bucket policy to allow this. Then use a WAF ACL to allow only your CIDR addresses to access the distribution.

profile pictureAWS
전문가
kentrad
답변함 일 년 전
profile picture
전문가
검토됨 일 년 전
profile picture
전문가
검토됨 일 년 전
profile picture
전문가
검토됨 일 년 전
0

thanks.This worked

Dhaval
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인