1 réponse
- Le plus récent
- Le plus de votes
- La plupart des commentaires
0
Hello.
It is possible to restrict the source of uploads to an S3 bucket by implementing IP restrictions as shown below.
CodeBuild can connect to a VPC, so you can access S3 using a NAT Gateway or a VPC endpoint.
In other words, by restricting the source of connections using bucket policy, you can prevent uploads from outside even if a signed URL is misused.
https://docs.aws.amazon.com/codebuild/latest/userguide/vpc-support.html
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "IPAllow",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::example-bucket-name/*",
"Condition": {
"NotIpAddress": {
"aws:SourceIp": "NAT Gateway IP"
}
}
}
]
}
If you want to restrict it by VPC endpoint, you can do the following:
{
"Id": "VPCe",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VPCe",
"Action": "s3:PutObject",
"Effect": "Deny",
"Resource": "arn:aws:s3:::example-bucket-name/*",
"Condition": {
"StringNotEquals": {
"aws:SourceVpce": [
"VPC Endpoint ID"
]
}
},
"Principal": "*"
}
]
}
Contenus pertinents
demandé il y a 2 ans
demandé il y a 3 ans
demandé il y a un an
- AWS OFFICIELA mis à jour il y a 10 mois

Can you please confirm the steps I followed are correct above?
If you can't set up cross-account access then your approach using signed URLs is probably correct. By the way, is it not permitted to modify the bucket policy of the S3 bucket?