Open AWS Console (or aws cli)
Create a new stack
Use below cloud formation
Note- - Change the user data part to your custome code. A sample code is already added in this cloud formation template.
- Make sure you have atleast 1 public and 1 private subnet ready.
- Private subnet must be able to connect to internet (Use Internet Gateway or NAT for that)