[MUSIC] A beautiful aspect of the cloud, regardless of if you're using platform as a service or infrastructure as a service, is that you can take advantage of really sophisticated services. That the cloud provider offers, that you probably wouldn't be able to cost-effectively, or efficiently manage yourself. Now, many of these really complex services, things like Big Cable, or Dynamo DB, they might going to be outside of your, sort of, area of expertise for your particular organization. Or, you maybe a lone developer that's building a mobile application and setting up, and managing something like Amazon Dynamo DB, and guaranteeing its performance could be really hard to do. Amazon however can hire that really specific expertise needed to build something like Amazon DB. And actually, you know, monitor it and ensure that it scales and ensure it meets its service level agreements to you because they're amortizing their costs across thousands of customers that are all using that infrastructure. Whereas you would just be amortizing your costs across the, you know, the level that you could use it. So it would be harder to amortize all of the development and set up and other costs. So all of these cloud services that the provider gives you. Allow you to get access to very sophisticated capabilities that might, might not be cost effective, or might not even really be within the re, the realm of capability for your organization to take advantage of without a cloud provider there to support it. So one thing you should think about when you're building your application is what to offload to the provider, versus do yourself. And there's a number of things you should think about. One, the cost, is it really going to be cheaper for you to do this yourself? And in many cases it's not, and this will be cheaper. It, if the cloud provider is amortizing this cost across thousands of clients, many cases they can offer it cheaper than you can. So for example, Google Drive is now incredibly cheap to use. You can get a terabyte of cloud storage for ten bucks a month, or something along those lines. And who knows it may be even cheaper by the time I'm done with this lecture. So it may be very hard for you to provide an equivalent, you know, highly available, highly performing cloud data storage system. And to compete with Google or maybe you can. So cost should be a big, you know, consideration. The cost shouldn't just include, how much it would cost you to go, and buy the hard drive and connect it to the network. The moment that you incorporate that hard drive into your application, you're going to have to manage it and deal with it for as long as you're using it. And it may be easy to manage one hard drive but as your application scales and grows you're going to suddenly be stuck with managing thousands of hard drives, or maybe you're going to be dealing with more. And suddenly when you start having failures, and you're starting to have to think about scalability and dealing with all of the issues regarding buying more hard drives, and plugging them in. The management costs may not make sense, so in the small it may not make sense to you offload. In the large you know, particularly if your organization can't scale up fast enough, and hire people fast enough, and build all of the expertise to manage the things fast enough, it may be much, much more expensive to do it yourself than to use a provider. Or maybe it is the other way around, but you have to think about, you know, what do you really want to do yourself? If you are a small organization, it's going to be very hard to compete with the capabilities that the cloud provider can provide for you. And if you are a single developer building a mobile app it's going to talk to a cloud service you're almost always going to want to tap into the things that the providers give you. Now, here's some of the interesting capabilities you should be aware of, that are out there in the Clouds. One is CDN, Content Delivery Network. So, the providers will give you the ability to take static content that you would like delivered very quickly to your mobile clients, and to distribute it and cache it across the world. So that whoever is requesting it can get a very close and quick copy of it. Another one are their database services, particularly for their no SQL databases, where you don't have to worry about, how you're going to scale up and manage a databases. You can just go and tap into something like Big Table or Amazon Dynamo DB or whatever it is, what other database you're using. Providing all the infrastructure to support the database and manage it, takes so, you know, a lot work, and you know you could certainly go and set up your own instance of whatever particular database you want. If you really want to do MongoDB and manage it yourself. You can do that, or you can try to find a provider who will set up, and manage Mongo for you, or a provider who has Dynamo DB and tap in it yet. So you need to think about content delivery networks, databases, cloud storage. So this is a particularly useful thing if you're going to be, for example, uploading videos. And there may be interesting pricing symmetries particularly if you're operating a particular provider's cloud, that make it make much more sense to also leverage their service that they're providing. So to give you an example of this let's say you're uploading videos and you, to Amazon's cloud. And you can either upload those videos to your servers, that are running on virtual machines in EC2, and then have those servers store them directly in S3, or on disk or somewhere else or you can have the videos uploaded directly to Amazon S3. Well an interesting thing is all of your traffic into S3 to store those videos would be free. You would only pay to serve the videos out of S3. However you're traffic to send the videos if you route them through Amazon EC2. And then store them on disk or send them of to S3 or somewhere else. That traffic isn't free. You, depending on how you're configured the IP addresses, you may be paying for the actual bandwidth, but either way, you're going to be paying for the fact that your servers are going to be tied up to some degree. They're going to be consuming bandwidth that's allocated to upload the videos. They're going to be having CPU cycles to process and manage those incoming requests to upload videos. And then they're going to be using up outgoing bandwidth to send those videos wherever they're going to go. So in sit, situations like that, although you might like to have that extra layer of control, just going directly to something like S3 maybe more cost effective if you're already running on Amazon. So you have to think through those issues. But if there was one issue that I think should drive your decision to use a provider services versus your own expertise and custom built thing, is to think about if my application suddenly scaled up a 1000 times and it happened next month. Could I grow fast enough to support that? Could I grow as an organization and hire people fast enough? Could I go and buy physical infrastructure if I need to do that fast enough? Could I support all of the things that are going to be required, including architectual changes, which could be very difficult to implement, in order to support that scale of growth. And if you would all have an app that you're expecting to grow like that, then it's, and you can't answer yes to that question, then you should go off and think about using the provider's services absolutely. Because the fact that you can simply say I want more capacity, give it to me, and I will pay you for it. And typically a lot of these things get cheaper the more of it you use. Your costs may go down as your capa, as your demand goes up. Whereas if you're managing all of these architectural, hiring and other complexities to scale your organization, your application up and you don't know if you can even do it fast enough if your application starts growing quickly. It doesn't make sense to try to do it in the first place. Build from the beginning with the plan to offload. Now some people get worried about, well what if I get locked into a particular, service provider and then for the end of time, I'm going to have to have my data over there. It's always possible to build your application in smart ways. So using things like dependency injection and spring, you can build interfaces that abstract away the details of these individual services provided. Now you still have to understand how they operate at some level so that you don't treat a no SQL database like a relational database. But you can build interfaces to help decouple you from their specific APIs and implementation. And there are lots of ways to either migrate out of a particular provider or to even, you know, distribute your, your business across multiple providers. And there are frameworks out there that can help you to do that. But when you're building your application, think about, can you scale up quickly enough in each of the areas that you're going to need scalability? If you can't, very carefully think about what cloud provider services are there that you could take advantage of to allow yourself to scale quickly. And what would be the cost of doing it yourself at a small scale versus a large scale and the same thing for using a particular provider.