问题原文
原帖链接 · M. Glatki · CC BY-SA 3.0
I added a VPC endpoint to my VPC using CloudFormation, and allowed s3 usage. The routes are visible in the AWS console, but not in the local routing tables of the EC2 instances:
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.29.4.129 0.0.0.0 UG 0 0 0 eth0
169.254.169.254 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
172.29.4.128 0.0.0.0 255.255.255.128 U 0 0 0 eth0
How do I verify that the EC2 instances in the VPC actually uses the VPC endpoint for S3, and not the available internet connection?
已采纳解答
原帖链接 · M. Glatki · CC BY-SA 3.0
I have found a method to verify the VPC endpoint usage.
- Log in to an AWS EC2 instance in the VPC
- Configure the aws cli client
- run
aws ec2 describe-prefix-lists; for Windows PowerShell,Get-EC2PrefixList
The result should contain the the VPC endpoints prefix list ID in the attribute PrefixListId.
For additional verification, you can apply the following policy to an S3 bucket:
{
"Version": "2008-10-17",
"Statement": [
{
"Effect": "Deny",
"Principal": "*",
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::mybucket"
],
"Condition": {
"StringNotEquals": {
"aws:sourceVpc": [
"vpc-121212"
]
}
}
}
]
}
with your vpc ID instead of vpc-121212. You should then only be able to access the S3 bucket from the given VPC
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
