This would help contribute to 0 downtime for me if possible. As far as I know it is not possible, but wanted to be sure.
No, this is not possible in EC2.
You'll need to stop your EC2 and change the instance type to add more RAM so no it can't be done dynamically, or on-the-fly.
You're interested in no downtime so you should take a look into a number of features:
- Elastic Load Balancing (ELB)
- Elastic Network Interface (ENI)
You can create an ELB and attach an EC2 to it. Next you could clone your EC2, change it's instance type, and bring the clone into the load balancer. Finally you terminate the old EC2 out, completing the 'zero downtime' upgrade.
You could attach an ENI to your EC2. Create a clone, change instance type, attach ENI to the new EC2. Finally, terminate the old EC2.