要让其他子网能够访问AWS接口终点,你可以使用VPC端点(VPC Endpoint)或NAT网关(NAT Gateway)来实现。
下面是一个使用AWS CLI创建VPC端点的示例代码:
aws ec2 create-vpc-endpoint \
--vpc-id your-vpc-id \
--service-name com.amazonaws.your-interface-endpoint-service \
--subnet-ids your-subnet-id \
--policy-document "{\"Statement\": [{\"Effect\": \"Allow\", \"Principal\": \"*\", \"Action\": \"*\", \"Resource\": \"*\"}]}"
下面是一个使用AWS CLI创建NAT网关的示例代码:
aws ec2 create-nat-gateway \
--subnet-id your-public-subnet-id \
--allocation-id your-eip-allocation-id
请注意,以上示例代码中的参数需要替换为你自己的实际值。