Well, I am trying to find a cloudformation template in AWS.
Where would I need to create three VPC's with single subnet and instance in it. Where you have internetgateway in it with 2 one-way from vpc to gateway and one two-way connection like this:
You can leverage the AWS Quick Start's Amazon VPC Architecture template to get started quickly with a boilerplate VPC architecture. This AWS-supported template creates a single VPC containing both a public (2-way) and private (1-way, outbound Internet only) subnet within each specified Availability Zone (you provide 2-4 Availability Zones as Parameters). I would recommend starting with the Quick Start, then later customizing to better fit your specific needs if necessary.
For your use case, you could specify 2 Availability Zones, then use the Private Subnets in each AZ for SubnetA and SubnetB, and the Public Subnet in one of the AZs for SubnetC.
(Note: I recommend against creating 3 separate VPCs for a single application. Distinct Subnets provide adequate network isolation, creating 3 separate VPCs duplicates many unnecessary additional resources such as Internet Getways, and there is a limit of 5 VPCs per region per AWS account.)
Here's a full working example that uses the Quick Start template directly as a nested stack: