This one requires consistency and patience, but I encourage you to take him out and expose him to as many different environments as you can. Kids can distinguish different environments and connect to the idea that different environments require different behaviors at a very young age. Many kids your boy's age that are bi and tri-lingual can distinguish who to use which language with even amongst strangers.
It is really just a matter of consistently giving him the necessary feedback as needed. It doesn't have to be discouraging or disrespectful, and he will forget and need reminders (he is two and they have a short attention span AND memory at this point). Now is a GREAT TIME TO START. The sooner the better actually, you never know when you'll wind up on a plane full of passengers, at a funeral or roped into a restaurant experience with extended family for example, when he'll need to know how to moderate his voice and actions to fit the occasion.
I would avoid using inside/outside voice exclusively. These are great descriptors, but you might couple them with quiet, soft, and loud as well. Our voice level is actually on a continuum and he will need to know a range of voices he can use. Softer and Louder are great vocabulary to use. In services (like weddings, church and funerals) he needs to know how to say nothing at all or whisper very softly. At restaurants he needs to know how to speak in a soft voice, at home his normal voice is fine indoors or outdoors and at the playground or arcade (such as CHuckee Cheese's) Loud voices are okay.
To Introduce the Concept
You might try reading this really fun book all about quiet things and loud things as an opener for talking about times and places for different kinds of voices. It is a board book and has things like, "mommy's shoes are loud" opposing a page that says, "slippers are quiet." I read it with a quiet voice contrasting with a loud voice depending on the page we were on. Then, we talked about it. "Can you think of places where you need to be quiet?" followed by "Can you think of places or times when you have to be silent?" AND the opposing, "Can you think of places or times when you need to be loud?" You can even talk about how kids with baby brothers and sisters have to use a quiet voice while the baby sleeps, even if they can use a loud voice the rest of the time (this way it isn't only about location, but also events and circumstances).
When you are going to an event, or public space with specific social more's, expose him with the proper preparation on your part. Prior preparation can and should include practice at home. Start the day with a description about what to expect and a little practice about what kind of voice is needed at said location. "Okay honey today we will be at _. This place is a 'soft voice' kind of place." Then include a reminder just before arrival. If he needs reminders while you are at said location, just a quick, "soft voice remember?" will generally be all he needs. Same thing at home with "inside and outside voice."
When he is doing a good job. Make sure to observe it from time to time. "I really appreciate the voice level you are using. You seem to have been trying to match your voice level to the occasion/location"
When you are going out, you'll also want to be prepared with activities to help him stay busy, distracted and engaged. For example, feel free to take him to "adult restaurants because this will allow him the experience so he knows what to expect and how to behave. If he doesn't learn it now, he still has to learn it, he'll just be older when he does (and "bad behavior" that is really naive behavior will just be that much more embarassing. BUT, bring some crayons, a favorite coloring book, a fidget sort of toy and a favorite book because it is a lot to expect for a kid to sit and do nothing quietly. By being there he is gaining the opportunity to learn from watching you though.