An application runs on an Amazon EC2 instance in a VPC. The application processes logs that are stored in an Amazon S3 bucket. The EC2 instance needs to access the S3 bucket without connectivity to the internet.
Which solution will provide private network connectivity to Amazon S3?
A. Create a gateway VPC endpoint to the S3 bucket.
B. Stream the logs to Amazon CloudWatch Logs. Export the logs to the S3 bucket.
C. Create an instance profile on Amazon EC2 to allow S3 access.
D. Create an Amazon API Gateway API with a private link to access the S3 endpoint.
A
技巧:排除明顯錯誤選項,在沒有明顯錯誤的選項中選擇最合理的選項。
本題需要在一個沒有互聯網連接的VPC內的EC2實例上實現到Amazon S3存儲桶的私有網絡訪問。
A. 正確。創建一個到S3存儲桶的VPC網關端點。VPC網關端點允許VPC內的資源(如EC2實例)與S3 存儲桶等AWS服務進行私有連接,而無需通過互聯網。這是實現VPC內資源與AWS服務之間安全、私有通信的理想方式。
B. 不正確。將日志流式傳輸到 Amazon CloudWatch Logs,然后將日志導出到 S3 存儲桶。這個選項改變了日志的收集和存儲方式,但并沒有解決EC2實例如何安全、私有地訪問S3 存儲桶的問題。
C. 不正確。在Amazon EC2 上創建一個實例配置文件以允許 S3 存儲桶訪問。實例配置文件(通常指 IAM角色)確實可以為 EC2 實例提供訪問 S3 存儲桶的權限,但它本身不提供網絡連接。沒有適當的網絡配置(如 VPC 端點),即使有權限,EC2 實例也無法在沒有互聯網連接的情況下訪問 S3 存儲桶。
D. 不正確。創建一個Amazon API Gateway API,并使用私有鏈接訪問 S3 存儲桶端點。API Gateway主要用于公開API的創建、發布、維護、監控和安全控制,而不是用于VPC內部資源之間的私有通信。API Gateway通常用于處理HTTP請求,而S3的訪問更多是通過AWS SDK或S3 API直接進行。