Skip to content

At least two subnets in two different Availability Zones must be specified #635

@VarinderSandhu

Description

@VarinderSandhu

Guidance Question

At least two subnets in two different Availability Zones must be specified

The Question

Error while creating ALB using cloud formation template as below .i aleady have multi az subnets .
error : At least two subnets in two different Availability Zones must be specified (Service: AmazonElasticLoadBalancing

AWSTemplateFormatVersion: 2010-09-09
Description: CloudFormation template for creating a task definition
Resources:
FargateAlb:
Type: 'AWS::ElasticLoadBalancingV2::LoadBalancer'
Properties:
Name: FargateAlb
Subnets:
- subnet-xxxxx
- subnet-xxxx
- subnet-xxxxxx
Type: application
MyFargateTargetGroup:
Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
Properties:
Name: MyFargateTargetGroup
VpcId: vpc-xxxxxxxxx
Protocol: HTTP
Port: 8000
HealthCheckPath: /actuator/
TargetType: ip
Listener:
Type: 'AWS::ElasticLoadBalancingV2::Listener'
Properties:
DefaultActions:
- TargetGroupArn: !Ref MyFargateTargetGroup
Type: forward
LoadBalancerArn: !Ref FargateAlb
Port: 80
Protocol: HTTP
FargateAlbSG:
Type: 'AWS::EC2::SecurityGroup'
Properties:
GroupDescription: SG for the Fargate ALB
GroupName: FargateAlbSG
SecurityGroupIngress:
- CidrIpv6: ::/0
FromPort: 80
ToPort: 80
IpProtocol: TCP
Description: 'Inbound rule for IPv6 traffic'
- CidrIp: 0.0.0.0/0
FromPort: 80
ToPort: 80
IpProtocol: TCP
Description: 'Inbound rule for IPv4 traffic'
FargateAlb:
Type: 'AWS::ElasticLoadBalancingV2::LoadBalancer'
Properties:
SecurityGroups:
- !GetAtt FargateAlbSG.GroupId

CDK CLI Version

At least two subnets in two different Availability Zones must be specified (Service: AmazonElasticLoadBalancing

Example

No response

Example Version

No response

OS

No response

Language

Typescript, Python

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidanceQuestion that needs advice or information.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions