Hey @Suraj, For me its working fine. You need to verify that have you verified aws credentials or not?
This is the code I used for creating an Instance.

The instance Id was displayed as an output for ec2.create_instance
Here is the instance created.

Give me some more details on your error so that I can suggest you the solution.