当AWS App Runner服务被添加到VPC中时,它将默认接收来自该VPC的Internet流量,但是无法到达Internet。如果要允许AWS App Runner访问Internet,需要通过在VPC中设置“Internet Gateway”来实现。
以下是使用AWS CLI添加Internet Gateway到VPC的代码示例:
aws ec2 create-internet-gateway --region
以下是将Internet Gateway添加到VPC并分配路由表的代码示例:
aws ec2 attach-internet-gateway --internet-gateway-id --vpc-id
aws ec2 create-route --destination-cidr-block 0.0.0.0/0 --gateway-id --route-table-id
在以上示例中,将“
完成上述步骤后,AWS App Runner服务将能够通过Internet访问所需的资源。