[英]AWS elb in ansible scritp is not assigning the vpc id which I already assigned to my security group and subnets
We have common vpc created for all our project. 我们为所有项目创建了通用vpc。 I have created the subnets and security group using the vpc manually.
我已经使用vpc手动创建了子网和安全组。
I do the automation for creating ELB. 我负责创建ELB的自动化。 I create the elb using ansible script.
我使用ansible脚本创建elb。 If I create elb with the security group and subnets, it is assigning the
default vpc
instead of the custom vpc
we have used for our subnet. 如果我使用安全组和子网创建elb,它将分配
default vpc
而不是我们用于子网的custom vpc
。
We tried to assign the custom vpc as well as using vpc_id which is not supporting. 我们尝试分配自定义vpc以及使用不支持的vpc_id 。 We get the
Security group "sg-0567" does not belong to VPC "vpc-7456as"
error. 我们得到
Security group "sg-0567" does not belong to VPC "vpc-7456as"
错误。 It is trying to create the elb with default vpc. 它正在尝试使用默认vpc创建elb。
Please advise how to assign the our custom vpc which is already created by us during the automation 请告知如何分配我们在自动化过程中已经创建的自定义vpc
There is no separate parameter to pass the vpc-id
when creating ELB. 创建ELB时,没有单独的参数可传递
vpc-id
。 The vpc is assigned based on the subnet-id's
you provide in the template. 根据您在模板中提供的
subnet-id's
分配vpc。
Sample template snippet : 样本模板摘要 :
instance_ids:
- i-abcd1234
region: us-east-1
subnets:
- subnet-abcd1234
- subnet-1a2b3c4d
listeners:
- protocol: http
load_balancer_port: 80
instance_port: 80
If subnet-abcd1234
and subnet-1a2b3c4d
are part of vpc-abcd1234
, then the ELB is automatically assigned to that VPC. 如果
subnet-abcd1234
和subnet-1a2b3c4d
是vpc-abcd1234
一部分,则ELB将自动分配给该VPC。 When you dont pass any security-group, the default security-group
of that VPC is assigned to the ELB automatically. 当您不传递任何安全组时,该VPC的
default security-group
将自动分配给ELB。
Done forget to pass the region
. 做忘了通过该
region
。 It is always a good practice. 这始终是一个好习惯。 If not specified then the value of the AWS_REGION or EC2_REGION environment variable, if any, is used.
如果未指定,则使用AWS_REGION或EC2_REGION环境变量的值(如果有)。
When you get the Security group "sg-0567" does not belong to VPC "vpc-7456as"
error, then it means the security-group which you are passing in the script to the ELB is not part of the VPC which the ELB is assigned. 当您获得
Security group "sg-0567" does not belong to VPC "vpc-7456as"
错误时,则意味着您在脚本中传递给ELB的安全组不属于ELB所在的VPC。已分配。 ie. 即。 Your security-group and Subnet are NOT part of same VPC.
您的安全组和子网不是同一VPC的一部分。
Remember security-groups can span across multiple subnets but not across multiple VPC. 请记住,安全组可以跨多个子网,但不能跨多个VPC。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.