简体   繁体   English

AWS ECS集群-实例

[英]AWS ECS Cluster - Instances

I have a "Custom VPC" with two subnets (A private subnet & a public subnet). 我有一个带有两个子网(一个私有子网和一个公共子网)的“自定义VPC”。

In ECS, when I try and create a cluster with "Custom VPC" and both subnets selected. 在ECS中,当我尝试使用“自定义VPC”和两个子网选择创建集群时。 The EC2 instances launched, are by default launched in the private subnets. 启动的EC2实例默认情况下在专用子网中启动。

  1. Why?, Is there a way to change the instance subnet after it is launched? 为什么?启动实例子网后,是否可以更改它?
  2. Should ECS cluster only have public subnets of a VPC? ECS群集是否应仅具有VPC的公共子网? and launch an instance on the private subnet through the 'Launch instance' wizard? 并通过“启动实例”向导在专用子网上启动实例?
  3. Also, these instances have a public DNS even when the private subnet 'auto assign public IP' is disabled. 同样,即使禁用了专用子网“自动分配公用IP”,这些实例也具有公用DNS。 Why? 为什么?

1: You need run ECS in the public subnets reference : https://docs.aws.amazon.com/AmazonECS/latest/developerguide/get-set-up-for-amazon-ecs.html 1:您需要在公共子网参考中运行ECS: https : //docs.aws.amazon.com/AmazonECS/latest/developerguide/get-set-up-for-amazon-ecs.html

2: Yes or you need to create a private subnet with NAT gateway tied to it 2:是的,否则您需要创建一个绑定了NAT网关的专用子网

Every instance in a VPC has a default network interface, called the primary network interface (eth0). VPC中的每个实例都有一个默认的网络接口,称为主网络接口(eth0)。 You cannot detach a primary network interface from an instance. 您不能从实例分离主网络接口。 You can attach a new network interface. 您可以附加一个新的网络接口。

To change the subnet of launched EC2 instance, you can follow this steps: 要更改已启动的EC2实例的子网,可以按照以下步骤操作:

  1. Create a new ENI (elastic network interface) with the new subnet you want to change. 使用要更改的新子网创建一个新的ENI(弹性网络接口)。 Notice that you cannot change VPC of an launched EC2 instance. 请注意,您无法更改已启动的EC2实例的VPC。 If the same VPC or availability zone does not have other available subnets, you should create a new subnet first. 如果同一VPC或可用性区域没有其他可用子网,则应首先创建一个新子网。
  2. Go to your EC2 console and select the EC2 instance you want to change subnet. 转到EC2控制台,然后选择要更改子网的EC2实例。
  3. In the Action menu above, go to Networking > Attach New Interface. 在上方的“操作”菜单中,转到“网络”>“附加新界面”。
  4. In the Network Interface menu, choose the network interface you just created. 在“网络接口”菜单中,选择刚创建的网络接口。

You can reference to this document for how to create and attach a new network interface for an EC2 instance. 您可以参考本文档,了解如何为EC2实例创建和附加新的网络接口。 https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM