Add RAM to ec2 instance
EC2 instances have a very specific configuration regarding CPU, RAM, local instance storage, etc.
It is not possible to alter that configuration.
If your application needs more RAM than a micro instance can give you, then you need to move to a different EC2 instance type.
For 2 GB of RAM, you can change your instance to a t2.small instance.
Stop the instance. Change the instance type to the one that has the desired RAM and start the instance. You need t2.small for 2GB.
It goes without saying if you have an elastic IP assigned, stop/start will not change the IP. But if you have a (auto) public IP assigned, then the public IP will change after stop/start. If the machine is in a private subnet, then stop/start has no effect on the IP.