I get this error whenever I launch my stack (Network interfaces and an instance-level security groups may not be specified on the same request) and cannot figure out what the issue is, even after changes and looking at the issue online.
My stack includes 2 ec2-instances in the public subnet, and 2 ec2-instances in the private subnet. The webservers(public) both have elastic ips, and have an individual security group for each.
I tried swapping SecurityGroupIds to SecurityGroups but that didn't change the error. I also tried removing Groupset completely, same error occurs.
WebServerInstance:
Type: 'AWS::EC2::Instance'
Properties:
UserData: !Base64
'Fn::Join':
- ''
- - WebEIP=
- !Ref WebEIP
ImageId: ami-d7576bc1
InstanceType: t2.micro
KeyName: !Ref KeyName
NetworkInterfaces:
- AssociatePublicIpAddress: 'true'
DeleteOnTermination: 'true'
DeviceIndex: '0'
GroupSet:
- !Ref PublicSecurityGroup
PrivateIpAddress: 10.1.1.100
SubnetId: !Ref PublicSubnetAZ1
SecurityGroupIds:
- !Ref PublicSecurityGroup
After launching this stack, most of the resources are created except when it reaches WebServerInstance1 and WebServerInstance2 (the ec2 instances in the public subnet) where the error is
Network interfaces and an instance-level security groups may not be specified on the same request (Service: AmazonEC2; Status Code: 400; Error Code: InvalidParameterCombination