0
votes

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 (Service: AmazonEC2; Status Code: 400; Error Code: InvalidParameterCombination; Request ID:....))

and the status in Aws console is: ROLLBACK_COMPLETE

How I can solve this error?

EC2Instance:
Type: 'AWS::EC2::Instance'
Properties:
  SecurityGroups: 
    - !Ref SecurityGroup
  KeyName : !Ref EC2Key
  AvailabilityZone: us-east-2a
  ImageId: ami-01410f0e8f8b1acca
  InstanceType: t2.micro
  NetworkInterfaces:
    - DeviceIndex: '0'
      SubnetId: !Ref PublicSubnet
1
The error means what it says. You can't specify both a network interface and a security group property. You must choose one or the other. If you go with the network interface, you specify the SG within that interface.Rome_Leader

1 Answers

2
votes

Is there a specific reason why you want to specify network interface?

If all you need to accomplish is to deploy the instance into the specific subnet, just drop the NetworkInterfaces part and specify the subnet for the instance itself.

EC2Instance:
Type: 'AWS::EC2::Instance'
Properties:
  SecurityGroups: 
    - !Ref SecurityGroup
  KeyName : !Ref EC2Key
  AvailabilityZone: us-east-2a
  ImageId: ami-01410f0e8f8b1acca
  InstanceType: t2.micro
  SubnetId: !Ref PublicSubnet