gpt4 book ai didi

amazon-web-services - 遇到不受支持的属性 SecurityGroupId

转载 作者:行者123 更新时间:2023-12-03 07:47:24 25 4
gpt4 key购买 nike

我想要配置应用程序负载均衡器,但出现错误:

Encountered unsupported property SecurityGroupId

我的 CloudFormation 模板是:

AWSTemplateFormatVersion: 2010-09-09

Description: AWS CloudFormation Sample Template for creating LoadBalancer

Parameters:
VPC2Block:
Description: VPCId of your existing Virtual Private Cloud (VPC)
Type: String
Default: vpc-0c9a732125ac08541

PublicSubnet03Block:
Description: SubnetId of an existing subnet (for the primary network in your Virtual Private Cloud VPC)
Type: String
Default: subnet-0787f34404852ceb9

Resources:

ApplicationLoadBalancer:
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
Properties:
Name: MyApplicationLoadBalancer
Type: application
IpAddressType: ipv4
Scheme: internet-facing
SecurityGroupId: !Ref Albsg
SubnetId: !Ref PublicSubnet03Block
Tags:
- Key: Name
Value: ALB

HTTPListener:
Type: "AWS::ElasticLoadBalancingV2::Listener"
Properties:
LoadBalancerArn: !Ref ApplicationLoadBalancer
Port: 80
Protocol: "HTTP"
DefaultActions:
- Type: forward
TargetGroupArn: !Ref ALBTargetGroup


ALBTargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
HealthCheckIntervalSeconds: 10
HealthCheckPath: /
HealthCheckTimeoutSeconds: 5
HealthyThresholdCount: 2
Matcher:
HttpCode: 200,302
Name: MyWebServers
Port: 80
Protocol: HTTP
TargetType: instance
UnhealthyThresholdCount: 5
VpcId: !Ref VPC2Block


Albsg:
Type: 'AWS::EC2::SecurityGroup'
Properties:
GroupName: ALB-sg
GroupDescription: Security group for Load balancer
SecurityGroupIngress:
- CidrIp: 0.0.0.0/0
FromPort: '80'
IpProtocol: tcp
ToPort: '80'
Tags:
- Key: Name
Value: ALB_SG

Outputs:
TargetGroupName:
Value: !Ref ALBTargetGroup
Description: Name of Target ARN

最佳答案

AWS::ElasticLoadBalancingV2::LoadBalancer - AWS CloudFormation文档显示:

Type: AWS::ElasticLoadBalancingV2::LoadBalancer
Properties:
IpAddressType: String
LoadBalancerAttributes:
- LoadBalancerAttribute
Name: String
Scheme: String
SecurityGroups:
- String
SubnetMappings:
- SubnetMapping
Subnets:
- String
Tags:
- Tag
Type: String

您的模板具有未定义的 SecurityGroupId

也许您打算使用SecurityGroups

关于amazon-web-services - 遇到不受支持的属性 SecurityGroupId,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75896201/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com