I cannot answer specifically to Google app cloud, but here is what is happening behind the scenes.
When you go to www.domain.com there is a DNS lookup. So you must first have dns for www.domain.com, pointing at the same server, servers (if you are doing round robin dns load balacing), or load balancing ip (if you are load balancing somewhere else) as domain.com. You didn't say, but I imagine this is already working and all you want to do is the "redirect".
To know that a client is going to www.domain.com instead of domain.com, you need to inspect the Host header in the HTTP Request. This is at Layer 7 of the traditional OSI model. If your app cloud has a device like a multilayer firewall or reverse proxy before the server, you could read this header there and then reply to the client with a 302 Location domain.com, which will redirect them as you like. Otherwise, you can also do this on your web server. The pseudo code would be like:
if Host equals www.domain.com
then generateHTTPResponse(302,Location=domain.com)