There are 2 ways to do the same :
METHOD-1
While launching the instance,
1) Go to Configure instance
2) You will see 'Auto-assign Public IP' with a drop-down menu
3) Choose Enable and launch the instance
METHOD 2
1) Login to https://console.aws.amazon.com/console
2) Click on Services and choose VPC
3) Go to Your VPCs and select the VPC connected to your instance
4) Click on Actions and you will get a drop-down menu
5) Choose: Edit DNS Hostnames
6) Change the option to YES