- Newest
- Most votes
- Most comments
The issue you're encountering with your CloudFormation template for creating an EC2 instance with multiple network interfaces is likely related to how you've structured the NetworkInterfaces property.
In CloudFormation, when defining multiple network interfaces for an EC2 instance, you need to use a list format for the NetworkInterfaces property. Each network interface should be defined as a separate item in this list.
Based on the error message you've shared, it appears that CloudFormation is interpreting your NetworkInterfaces property as a single interface rather than a list of interfaces. This is why it's complaining about unexpected additional properties.
To fix this, you should structure your NetworkInterfaces property as a list, even if you're only defining one interface. Here's an example of how it should look:
NetworkInterfaces: - AssociatePublicIpAddress: "true" DeviceIndex: "0" GroupSet: - !Ref SecurityGroup SubnetId: !Ref Subnet
If you want to add a second network interface, you would add another item to this list:
NetworkInterfaces: - AssociatePublicIpAddress: "true" DeviceIndex: "0" GroupSet: - !Ref SecurityGroup SubnetId: !Ref Subnet - AssociatePublicIpAddress: "false" DeviceIndex: "1" GroupSet: - !Ref AnotherSecurityGroup SubnetId: !Ref AnotherSubnet
Make sure each network interface has a unique DeviceIndex. The primary network interface should have a DeviceIndex of 0.
By structuring your NetworkInterfaces property as a list, you should be able to resolve the error and successfully create your EC2 instance with multiple network interfaces using CloudFormation.
Sources
AWS::CloudFormation::Interface - AWS CloudFormation
Creating your first stack - AWS CloudFormation
How CloudFormation works - AWS CloudFormation
WOW, figured it out. "SourceDestCheck" : false, should be under individual interface.
answered 2 years ago
Relevant content
asked 3 years ago
asked 2 years ago
