<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Carlo Acebedo on Medium]]></title>
        <description><![CDATA[Stories by Carlo Acebedo on Medium]]></description>
        <link>https://medium.com/@carloacebedo?source=rss-7ab6a30c54a5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*g9nqaBVQbON2y0Cl4Vju4A.jpeg</url>
            <title>Stories by Carlo Acebedo on Medium</title>
            <link>https://medium.com/@carloacebedo?source=rss-7ab6a30c54a5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 01:53:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@carloacebedo/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Creating a serverless movie rental application using Amazon Web Services]]></title>
            <link>https://python.plainenglish.io/creating-a-serverless-movie-rental-application-using-amazon-web-services-57a395671f0f?source=rss-7ab6a30c54a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/57a395671f0f</guid>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[api-gateway]]></category>
            <category><![CDATA[serverless]]></category>
            <dc:creator><![CDATA[Carlo Acebedo]]></dc:creator>
            <pubDate>Wed, 18 Nov 2020 06:24:33 GMT</pubDate>
            <atom:updated>2020-11-20T07:19:51.054Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Serverless Movie Rental Application using Amazon Web Services</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*zOypDTIdQWfRSCxxu66t-A.png" /><figcaption>Workflow</figcaption></figure><p>If you are a movie junkie, chances are, you’re already using Netflix, Youtube, Amazon prime video, etc. for everyday consumption. But did you ever wonder how these giant tech companies deliver videos from their servers all the way down to your device? In this article, we are going to create our own movie rental service and it is going to be serverless. According to the top result on google, <em>serverless architecture is a software design pattern where applications are hosted by a third-party service, eliminating the need for server software and hardware management by the developer.</em> If that went over your head, don&#39;t worry, I was also exactly like you when I first heard serverless and I got you covered 😉.</p><p>Serverless doesn’t literally mean not using physical servers. From a client perspective, we no longer have to manage servers ourselves. Instead, that work is offloaded to a third-party service. So in our case that “third-party service” is going to be AWS. Still don&#39;t get it? think of it as a laundry service. In this case, washing machines are the “servers”. We don&#39;t manage them. The laundry shop owner takes care of the maintenance of the machines. Our only business is to go there and have our clothes cleaned. If you’re still lost, you should check <a href="https://www.serverless.com/learn/why/">this</a> out😃 .</p><p>For this project we have three requirements to meet:</p><ul><li>1. We need to authenticate users, meaning we need users to be able to create their own accounts and login into our app.</li><li>2. Since we are making a movie rental service, the video should be secured and has limited viewing time.</li><li>3. It needs to be serverless 😃</li></ul><p><strong>THE SOLUTION: </strong>We will break the solution into 4 components:</p><ul><li>1. Hosting Service</li><li>2. Authentication Service</li><li>3. Database Service</li><li>4. Delivery Service ( a Content Delivery Network )</li></ul><p>First, we need to serve our application somewhere. We can easily spin up an EC2 instance but that would break requirement number 3 since that will require provisioning our own server. Luckily, S3 provides a web hosting service and it scales up automatically for us. Pretty neat right?.</p><p>Second, we need a service that will authenticate users for us. AWS Cognito is a gift sent from above that will securely take care of the sign-up and sign-in workflows of our application. We have two options to choose from if we want to integrate Cognito into our app. We can either use their pretty log-in UI or code our own using their beautifully well-documented SDK.</p><p>Here’s the login page that I’ve created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*9FIbZPQ7B1tCWRcfkMWDEA.png" /></figure><p>So how does this work? If you review the workflow above, you can see that whenever Cognito authenticates a user, it will send a JSON Web Token(JWT) as a response. You will see how we are going to use the JWT later.</p><p>We are halfway there. The third solution is pretty simple, perhaps you have already heard of it. We’ll make use of Amazon DynamoDB. DynamoDB has a feature where you can set a Time-To-Live (TTL) on your items. It is a good solution for our case since we need to delete the generated signed URL when it expires. We will set the user’s email as our primary key since we are sure that there can never be two identical emails registered on Cognito.</p><p>We are almost there. We need a Content Delivery Service (CDN) to ensure a faster experience for our users so we will use CloudFront. The video will be stored in a separate S3 bucket. We will deliver the video from S3 through CloudFront using OAI (Origin Access Identity) to prevent other users from accessing the video directly from our bucket making it more secure. I won&#39;t be covering the step-by-step process on how to configure the connection between CloudFront and S3, perhaps on future blogs.</p><p>Now that we are done setting up the four main components of our application, the only thing left to do is figure out a way for them to communicate. API Gateway and AWS Lambda are the heart and soul of this architecture. API Gateway is the middleman between our application and our server. It provides an endpoint that our users can invoke to get and put information. Lambda takes care of the processing of this information. In our case, we have two Lambda functions. The job of the first function is to retrieve the signed URL and expiration date of the video from the database. The other function’s job is to generate a signed URL and put the information about the user email, signed URL, and expiration date to the database.</p><p>Here is how our application looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*30V4PMGSn5s8hOgiZIwqzg.png" /></figure><p>So we have a fictional movie poster with a rent button. Whenever the user clicks the rent button to watch the movie; on the backend, the user is actually invoking an API Gateway endpoint. But does it mean that anyone can just use our API? Not quite. Remember the JWT we talked about earlier? here is how it comes into play. We are using Cognito as an authorizer for the API gateway. Whenever someone tries to talk to our API, the API gateway will ask for an additional header containing the JWT. This ensures that only those who are logged in can access our API.</p><p>Our application will look like this after clicking the rent button:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3HC4DowFfhO3EQeS4VRuSQ.png" /></figure><p>Cool right? behind that play button is the generated signed URL and also, we have a cool countdown UI beside it that uses the information about the expiration date coming from DynamoDB. Click <a href="https://serverless.eljohncorner.com/">here</a> for the live demo.</p><p>*** Interested in passing your next AWS Certification? ***</p><p>*** Check out Tutorials Dojo ***</p><ul><li><a href="https://portal.tutorialsdojo.com/">Home</a></li><li><a href="https://tutorialsdojo.com/">Home</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57a395671f0f" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/creating-a-serverless-movie-rental-application-using-amazon-web-services-57a395671f0f">Creating a serverless movie rental application using Amazon Web Services</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>