Categories
Online Marketing

AWS Serverless Web App Tutorial

We will be covering a new concept in cloud computing, namely the serverless architecture. What does this mean? Well, essentially, server less computing allows you to build and run applications and services without the need to manage the actual server. It also provides flexible scaling under heavy load and automated high availability becoming a very versatile tool.

The AWS server less platform has many capabilities, as you can see, but for the purpose of this article we will be showcasing the creation of a server less web app from scratch. The structure of this project can be easily understood by following this diagram. All of the front-end code will reside in the s3 storage unit, which allows us to host the website publicly. Therefore, we start by creating an empty s3 bucket, like so give it a unique global name and click create and now to upload the static websites content into the bucket.

I simply click upload and drag and drop the build folder into here. Like so note that I am using react as a framework, so it might be a bit different for you. The next step is making the pocket public and for that we go into permissions and pocket policy and paste this bucket policy. In order now public reads: click save and do not forget to change the bucket name. Now this bucket has gained public access.

As far as configuration is concerned, the only thing remaining is enabling the website hosting in the S stream, which will allow the objects to be available at the website. Endpoint of the bucket click properties and select this card to do so. Check use this pocket to host the website and input a route for us. It will be index dot HTML. Furthermore, you can set up a custom domain for your s3 bucket by following the tutorial right here, which will be linked in the description anyhow.

Now you have the endpoint of the website and if you click it, you will see that the static website has come online. Going back to the diagram. There are a couple of things left to do. We should set up an instance of the Amazon Cognito user pool which enables us to register log in and authenticate securely. Then we will write the backbone of the serverless project that are the various AWS lambda functions which replace the server as they access and manipulate of Amazon DynamoDB now SQL database and respond to easy to use restful api calls.

But first the user pool head to Amazon, kognito and click manage Azure pools. Here you can create one or several. These are pools based on your application, for instance, one for regular users and one for administrator. You give it a name and click preview default settings here. There are various options: the password length, some type of restrictions, for it. Verification by email is a really important one, because you actually also gain a two-factor authentication while using the Amazon, Cognito and finally create the user pool.

You can find it under the user pools category and make sure you note down the pool ID that it has given itself as well as the previous endpoint of the website. The final step of configuring, the user pool, is creating an app client for your project. I already have one in here, but you can always add multiple ones, just give it a name and make sure you deselect the generate secret client option, because that means that it doesn’t support the JavaScript SDK.

You can also manage and configure every single user in your user group by clicking here and, for instance, having the option to disable delete users even creating or importing new ones as well, and most projects use JavaScript these days after that, leave the other options as default And click create app client make sure you save the app client ID for future use. Once you have the two IDs you can insert them into your application and benefit from the various cognitive.

A P is like the login and register ones. Let us test this new functionality into the website. Now we can register a new user, for instance, with this email password that satisfies the constraints and of verification code has been sent to the said email. It has sent this Jason using the user pool ID and client ID that we have just provided it with, and we have already appeared as an unconformity in the user pool after user verifies himself.

He can also login by following the same procedure and of course you would get a warning if his password is incorrect, once kognito is out of the way. All that remains is the server less back-end. Aws lamda interacts with the database, so we must first create one head on to dynamo DB and click create table here, give it a name and the primary key you can choose between various types and then create.

For instance. Here is my database. I have events with various categories: DynamoDB is a non relational database and you can edit the data inside at any time as long as it is not the primary key of the item. For instance, here I have made a mistake. Event capacity should be a number and then click Save it successfully changed it. Furthermore, you can customize it by adding new fields inside it. Let’s say time of day morning, and then it would add that category now that we have the database, we need to create a role more specifically Identity and Access Management role for the future function, so that it has access to read and write to this database.

Specifically, so let us do just that: go on to the overview, tab and write down the Amazon resource name so that we know which database we’ll use then proceed to go to. I am and create a new role here: choose lambda as that’s the type of function that we will use in the filter, policies, search bar, begin typing, lambda and choose AWS lambda basic addiction role so that it will have permissions to write to cloud read logs so That you can see whether you have errors or not, then click Next provide a name for it and then you’re ready to create an actual role.

You can find it here in my case now to attach the policy for our specific database. Click here add inline policy for choose a service type DynamoDB actions. Let’s give it all the types of read rights and lists and for resources with specific option checked, go on to table and click. Add a RN here you can paste your your own database AR m and it will automatically fill in the fields, for you click Add, and then you can review the policy giving it a name as well once the role is created with both policies in place.

We are now ready to create the actual and the function. This is easily done by going to AWS lamda and clicking create function. I like living author from scratch. Option enabled for runtime give it the programming language of your choice, a name and the role. You can choose an existing role, and here you can see the one that we’ve just made. Example, lambda role create function and the base one will be created for you.

After we create a function. You can see that it already has access to the cloud read logs, as well as the Amazon DynamoDB database that we’ve just created the function itself is a hello world stub onto which you can build other functionalities in order to test it. You click here, give it a name and some parameters if needed. In our case it doesn’t use them, so it doesn’t really matter. Click create and again test.

As you can see, it says hello from lamda back. This is why we’ve added the cloud read logs policy. Now, on to a more complex example, we go into functions and get events. This is a lambda function which takes all of the events in the database. We’ve previously looked that that have reached past a certain hard-coded date due to this line here, using all the big land scan method, we click test and check out the results, seeing that it it does output all of the events.

In the same way, you can make a most event function, which takes into account the parameter is required to make a new entry in the database. Let’s name it test three in this case and click test. The function has added test three, so let us see that, and here it is going back to the function. Okay, I would have noticed that we have something called an API gateway here as a trigger what this does is.

It enables an URL which we can use in our application, on which we call witta get or post, for instance, and receive the result of the function back in JSON format. This is essentially the final piece of the puzzle that connects all of the services together. In order to create one remember, every function has one API gateway. We give it a name, a description if necessary and an endpoint type as choose edge.

Optimized in this case create the API. Go to actions, create a method of the type that your function is. Let’s put it at any select, lambda function, the region and the function that you’ve wanted. The API, for, let’s continue with the example function in our case, use the full time mode should be checked as well. You will land in this page and the API gateway is almost ready to be deployed. You’ll notice here in method, request, authentification is set to none.

What does this mean? Well, if we change that, we can make it so that, for instance, the view events viewing all of the events in the database is only allowed if you’re already logged in so after we do so only then we’ll be able to see the events. This is done by creating a new authorizer click kognito and give it a name. Let’s call it user select, the user pool that you’ve previously created and the token show source should be authorization create and then back in resources, click, any method, request, authorization refresh, and you can see the newly created user now only being logged in into that specific cognitive User pool, who will I allow you to access the specific function? Those being said, we are now ready to deploy the gateway API.

You should also note this option here enable cross-origin resource sharing. I recommend you to enable it if you like me, have opted to use Axios as a method of communication with the api, otherwise it wouldn’t work and finally deploy api, select a new deployment stage, with the name of your choice and clicking deploy. This will yield invoke. Url, which you will put in your application and don’t which will call with the get or post, depending on the function that you’ve wanted to call this server less web app functionality is now complete.

You have the static website sitting in the s3 storage in it with all the images CSS HTML, then the user pool uses kognito to manage the login register and authentication followed by the newly created database, which is populated and manipulated by the various lambda functions that you Will create which are called from the project through the Gateway API. Thus, they all amounts to a single web application which can be expanded upon easily.

Last but not least, regarding price. Well, the cost of creating the serverless web app is known as AWS accounts only for the time its service is actually run, which is mainly the amount of traffic and how many times the lambda functions compute. For me, personally, it has been less than 0.1 dollars and I have had the webapp on for a period of about two weeks time with extensive function tests. Ultimately, all of these resources are available in a github project and check the article description for more details.

Thank you for reading


 

Categories
Online Marketing

Facebook Ad Optimization 2019 [View Content, Add To Cart, or Purchase?]

Content Add to Cart or purchase when it comes to your Facebook ads and specifically specifically for products that you’re selling, like Shopify products drop shipping products and so on, and so on. I’m making new articles every single day talking about Facebook, Ads Shopify. All of these processes to make you an extremely good Facebook ad buyer so make sure to hit that subscribe.

Button ASAP. So before I get into showing or like talking about view, contents Add to Cart and all that I need to get a product up on my store and don’t worry, it only takes like two minutes. Let me just try to find something here. Maybe that’s trending rings from women solar, light running shoes. Let’s do a crossbody bags for women’s, because I see it’s trending, I’m going to search by orders, and this is a topic that I get asked like every single day.

Literally. So let’s go ahead and pick this one. This one looks like it has some good images here and people just want to know hey. You know what do I start with when launching new products do I start with view contents Add to Cart or purchases. So let me just go ahead and answer that in one second, once I get this product all set up and launched I’m actually it only takes me just come minutes, but let me go ahead and import it here, import list.

What do you want to call this? Tassel over the shoulder crossbody crossbody tassel bag. I don’t know how to spell and this description. Well, I need to get to the content in this article, nineteen, ninety five and three: nine. Ninety five, okay, perfect: let’s import to the store – and I am almost there so usually the way I like to do it is it really depends on your pics alright. So let’s go ahead and launch this real quick make the article it’s so funny, because people asked me also like I think I might have already launched a article about this, but like how many projects do you test per day as many as possible? Let’s say comment: yes, if you love heart their thumbnail, let’s call it cross.

Make articles grab the link okay, so the article is being created and we’re just at the point about to be at the point where I I pick my optimization, and it is really really key that you pick the correct, often optimization and like I was saying it Really just depends on where you are in the process. If you’re like me right here, where I’m launching a brand new product, I will usually target view content or Add to Cart and what would decides? Wouldn’t I honestly kind of do it randomly like one product I’ll test? You content one product I’ll test, Add to Cart, but the reasoning behind this and you can see the articles made.

The reasoning behind this is those are easy for Facebook to get, and you can see this is where I’m doing my targeting. So I like have Tassel, I have handbags and then a chill goes and finds more that are similar to that. So, like Michael Kors is probably good runway fashion, JustFab, okay, cool and let’s go ahead and go hit next step. I’m building out my campaign right here so grab yours and then here we go.

I can pick my Add to Cart view, content or purchases. So for a new product I usually don’t do purchases, and that is because, with Facebook’s their suggestions, you know my rep everybody else’s rep they’re, all they all say hey. You want to get 50 conversions in the first three days or so so, if you think you can get 50 purchases in the first few days of a brand new product go for it, but I highly doubt that unless you’re doing huge budgets, you know I’m saying, Like I do probably three to five dollar budgets – and you saw – I picked five different interest, so it’s going to create five ad sets, so it’s going to be 15 bucks.

The one that can get 50 conversions on is view content. For sure I mean if it doesn’t get 50 conversions, I probably kill the product, but I can also probably get Add to Cart. So I’m always picking one of these like higher up the funnel conversions, because I want to feed Facebook what they want. They say they want 50 conversions, okay. Well, let’s get you 50 conversions and then later I’m going to move to purchase, so the the the very correct way to do this would be to do it.

This way, you pick view content because it’s a brand-new product right. So I’ll say like isn’t this crossbody cute and I would pick my page pick. My pixel and I’d say: hey view content because I know, for you know, 3 times 5 interest, which is 5 different ad sets it’s going to be $ 15 going to women 25 plus, I should be able to get 50 convert. Conversions 50 view contents, because that’s just them opening it up the Shopify store and browsing around the page right, so I should be able to get 50 in the first three days off 15 bucks.

Let’s see, let’s say it’s a dollar view content, that’s 45, but I probably want to keep it if it was a dollar view content. So if it was at 75 cent view content, then that would be more than 50 and then what I would do is since I got 50 view contents. I would move it to add to cart. So I just go into the same campaign. Select all of them and then say, hey, Add to Cart conversion now, once it got 50 add to carts and it’s still doing well, I mean the campaign is still running.

I might have turned it off by now by the way, if it’s not showing me good results, I gained some purchases and whatnot. You check out my other article for that, but pretty much. I do like two to three times margin then turn off, but now switches to Add to Cart right and then, if I’m doing really well, like I mean a lot of sales, eventually I’m going to go to purchases because purchases, it’s saying, hey Facebook, go find me Buyers, you know who people who buy things online go find me more of those, so I can crush it.

So do 50, you know start off with view contents or add to cards, get 50 of those and then move to purchases. That being said, some products I’ve had they do better off at the carts, and maybe that’s because the conversion is easier and Facebook can optimize and there’s not a huge fall off from Add to Cart to purchase, but some do better with purchase so later on. In your campaigns, you always want to use add to cart or purchases.

I never really like on late stage, campaigns that are doing well. They can gain sales, I’m never doing well, just based off view contents view. Contents is like a rush of traffic: hey Facebook, here’s the data, you need and, to be honest, I usually start campaigns with add to carts. Sometimes you contents, but I always move to purchases and if the purchases don’t do as well. As the Add to Cart, I just moved back to add to carts, don’t be worried about switching up your conversion.

It’s fine! I’m going to call this ad chill crossbody and you saw how I launched that really quickly. Right click launch ad: it’s going to create the campaign, the article all that good stuff. So that’s another key like people ask me: what’s the key to success with dropship, I mean it’s finding winners. How do you find winners test more products? How do you test more products? Leverage tools like add, show in order to test products quickly.

Let me know in the comments below what are you optimized for you know. What’s your strategy, are you optimizing for add 2 cards of you contents purchases? When do you change them? You can see the campaign’s just been launched. I probably hit refresh over here and see it launched inside of my ads. It’s kind of a test account here for my articles, but you can see the cross body has been launched. Let me know below what do you walk to Mai’s for where you see the best results? For me, it’s usually Add to Cart.

So that’s why I launched /, Add to Cart. You can see they’ve five ad sets been created, women, women, 25, plus all those different interests and I’ll be able to see really quickly. Is this a you know a good product or know if it is I’ll, spend some more time on it? But the key is like spend as little time as possible testing each product. You’ll find more winners. You’ll save more time, see the ad here pretty solid right, so that’s about it guys make sure to go ahead and subscribe.

If you don’t worry about Joe, there should be a article showing you more about ad show subscribe to the article to the blog I’ll, make more articles every single day and yeah hope you have an amazing day, I’ll catch you in the next article bye,


Looking for a company that will have your back? Check out the video below: