简体   繁体   English

ansible scritp中的AWS Elb未分配我已分配给我的安全组和子网的vpc ID

[英]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-abcd1234subnet-1a2b3c4dvpc-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_REGIONEC2_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.

相关问题 AWS,带有公有和私有子网的VPC,传出安全组设置查询 - AWS, VPC with Public and Private Subnets, outgoing security group settings query 这些Elastic Beanstalk VPC选项意味着什么(公共IP,ELB / EC2的子网和安全组)? - What do these Elastic Beanstalk VPC options mean (public IP, subnets for ELB/EC2, and security group)? 如何在opscode Chef中创建AWS vpc,子网,安全组? - How can I create AWS vpc, subnets, security groups in opscode chef? AWS:VPC、子网、NACL、安全组、IGW、路由表等 - AWS: VPC, Subnets, NACLs, Security Groups, IGWs, Route Tables, Etc 安全组似乎与输入子网不属于同一VPC - Security group does not appear to belong to the same VPC as the input subnets 如何使用默认VPC将入站规则添加到AWS安全组? - How to add inbound rule to AWS security group with my default VPC? 在创建子网时引用CloudFormation脚本中的现有AWS VPC Id - Reference an existing AWS VPC Id in CloudFormation script when creating subnets Ansible和AWS子网 - Ansible and AWS Subnets AWS CloudFormation VPC CIDR 分配给安全组 - AWS CloudFormation VPC CIDR assign to Security Group 有什么方法可以使用 AWS CDK 代码将安全组和 VPC 分配给托管在 Elastic Beanstalk 中的 Web 应用程序 - Is there any way that I can assign Security Group and VPC to my web application hosted in Elastic Beanstalk using AWS CDK code
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM