Migrating from Spring Boot Microservices Project to Serverless using AWS - amazon-web-services

I have created a Spring cloud microservices project with netflix APIs and a frontend with React. Now, I want to migrate this project to serverless using amazon web services with DynamoDB and cognito. Do you know, which steps should I follow to do that? And what should I consider before doing this migration? For the Frontend React I decided to use S3 to host it.

Be sure if u really want to do this . This will be a big project; almost like re-writing complete codebase. Good part is that lambda supports Java so u might end up doing lots of copy paste. You would have a lambda function of each REST api endpoint u were exposing.

Related

AppSync and thoughts on being locked in AWS

I have been thinking about building a backend with graphQL.
The aim is to make the life of the backend team easier and iterate quicker rather then have to build REST endpoints or wss actions for each dataset retreivale.
GraphQL seems to be one of solution. We are very familliar with the Lambda environement and therefore in our research we found AppSync. I looks like a perfect solution, however I have some concerened around being locked in AWS and by designing the whole architecture around AppSync.
The beauty of serverless is that with the Serverless Framework, we could redeploy all functions to another cloud provider (Azure Functions) or even dockerize the functions for a deployment onprem.
I am concerned that with AppSync there is really no alternative in either other cloud providers or to easly do this onprem. Does anybody have any experience with this? Would it be more worth it to do the work to deploy an appolo server in lambda and build the connectors/listeners to the data sources our selfs with something like this: https://github.com/michalkvasnicak/aws-lambda-graphql/tree/aws-lambda-graphql%400.13.0#design-michalkvasnicak ?
IMHO, it comes down to how exactly the client of the GraphQL endpoint will secure data. One strategy is to secure an app with Amazon identity services like IAM and Cognito. Amplify's strength is secure integration with IAM, Cognito, API Gateway, DynamoDB, S3, and AppSync. A secure GraphQL endpoint on AppSync, for example. The data hosted in each AWS cloud service can be secured with Amplify and there are many other strategies too.
The serverless framework is a break through for serverless developer operations. The framework is beautiful. I don't disagree with your concern that Amplify generated cloudformation is not portable. Cloudformation is different DevSecOps culture than the Serverless framework. Amplify's generated DevSecOps code simply lands in Cloudformation culture.
I'm awfully new to GraphQL on the cloud, FWIW. I don't have experience with Apollo on Lambda. I cried, it looked difficult to automate the security though a seasoned pro may know. I certainly hope you get to a point where you never have to throw a single line of code away. I'm not even close, yet.
An easy entry point to the AWS eco system is to use AWS Amplify.
It has documentation guidance on security, GraphQL API, etc.

How to go from a web2py api on EC2 to an AWS lambda serverless apps?

A web2py API approach is a complet project which need a server and provide endpoint to manage the business logic. Basicaly You will run such a webapp on an AWS EC2 and it fully makes sense that the scalability will be handle both via horizontal and vertical scaling.
Whereas, the AWS lambda in the other hand is a fully RESTFul approach to build an api app by triggering every needed python simplest actions. Which provide the serverless gain (meaning You actually use resources only if needed).
It is quite simple, for some project, to see that the serverless approach is more flexible and financially more interesting than the EC2 approach for scaling.
So my question is : if you already have a web2py api webapp déployed on an EC2 instance, how to you go to deploy it in an aws lambda in other to gain the serverless aspect that aws lambda bring? Do You need to fundamentaly reshape the code architecture of the web2py apps to properly gain the AWS lambda fashion ?

Building an API on Google Cloud Platform

I'm building an app and the idea is to go serverless.
I'm looking mainly at AWS and GCP (Google Cloud Platform), and as AWS costs are a bit obscure (at least for me), and there is no way to ensure not being billed, I'm going with GCP.
For the "server" part of the app, I would like to build an API on GCP as I could do with AWS API Gateway, but I couldn't find any matching product for that.
The closer one was Google Cloud Endpoint, but it seems to have a very different concept from AWS API Gateway. I've watched some videos about it (for example https://www.youtube.com/watch?v=bR9hEyZ9774), but still can't get the idea behind it or if it fits my needs.
Could someone please help clarify which GCP product would be suitable for creating an API and how it compares to AWS API Gateway?
Some link with info/example on how to do it would be really appreciated.
Google Product Manager here.
We don't have an exact analog for AWS API Gateway.
You're right about Cloud Endpoints. It's a bit of a different architecture than AWS uses -- it's a sidecar proxy that gets deployed with the backend. That's different than API Gateway, which is a fully managed proxy deployed in front of your backends.
If you are deploying in App Engine Flexible environments: good news! The Endpoints Proxy can be deployed as part of your deployment. It can do things similar to AWS API Gateway (API key validation, JWT validation, rate limiting).
We are working on some plans to allow for the proxy to be used in other places (Cloud Functions and the newer App Engine Standard runtimes).
And, finally: on our older App Engine Java and Python runtimes, we have API Frameworks that provide the same functionality. Those frameworks do the same thing as the proxy, but get expressed as code annotations and built into your app. We're moving away from the framework model in favor of the proxy model.
An example of springboot project with google cloud app engine can be found here-https://github.com/ashishkeshu/googlecloud-springboot

How to deploy frontend application to GCE properly?

Here's the problem: I have a web application consisting of frontend part (written in VueJS) and backend part (API service written in Go).
What's the simplest and proper way to deploy such kind of application to GCE? The web application must be able to serve HTTPS.
In AWS world I could deploy frontend part to S3 (which supports HTTPS) and then deploy Go API to ElasticBeanstalk, for example. In GCE world there is Cloud Storage Standard that also supports serving static content (so I can deploy my VueJS part there), but it does not support HTTPS.
There is also Firebase, that supports HTTPS, but the only backend part I can use with that is Google Cloud Functions which means the whole backend part must be reworked.
Any idea what pattern I can use here to solve the problem? Or maybe I'm totally wrong and need to take a different look at it?
Firebase is the simplest way to deploy your frontend on Google's infrastructure. It handles certificate provisioning for you, so you get HTTPS out of the box. I'm not sure why you think Cloud Functions is the only backend you can use with it. You can use any backend you like, including Amazon's ElasticBeanstalk. I use both App Engine and Compute Engine backends with a Firebase frontend.
You could also do it the "old way" (how it was done when App Engine was Google's only cloud offering), and deploy your frontend to App Engine; it handles static content just fine.
There's not a single right way to do it. Your options are vast, and choosing one service to serve your frontend content in no way limits your choice for running your backend.

micro service web app with AWS

I am developing a web application for image upload and retrieval with AWS cloud services using a micro service architecture.
I am new to AWS and micro service architecture, please help me map the components of the architecture to AWS components.
Do i consider each micro service to run on one EC2 instance with auto scaling and load balancing?
Or do I run each micro service on one EC2 cluster?
If i put my static html files in an S3, how can i call database methods to load the html pages with content?
Is it by calling am API gateway from the client?
I have searched the web, but was unable to find a tutorial which implements multiple services as micro services using AWS EC2 / ECS.
Please help me figure out how to map my requirements and if there are any tutorials on implementing a similar app, will be very helpful.
Thank you in advance! :)
In short, you could use the serverless architecture i.e (with AWS's APIGateway and Lambda services) to build robust micro service based web applications.
Since you said that you were new to micro services architecture, I am listing down the best approaches.
Frontend/client
Single page applications(SPA) work well in the front-end and as they are a static site, they could be easily deployed to S3. This is the most cost efficient approach for SPAs. Here is a video deploying SPA on S3. This video will guide you through step by step instructions for deploying your SPA.
In case, you use react and redux in the front end, check out these steps for deploying react app to S3.
Backend
AWS EC2 is a good option. But there are many more alternatives available. As you said, you were new to backend, setting up EC2, VPC's and Elastic-ip is a little difficult process.
Nowadays, SPA's cover a lot of business logic, routing, etc., We need our backend only as API's for performing CRUD operations with database. I would like to suggest a bleeding edge technology called serverless. Here is the tutorial for launching your backend within 5 minutes. AWS lambda is a service that is called as function as service. You can build your backend using AWS lambda + API gateway + DynamoDB.
For eg: say you want to register some details in backend, you will POST all the data from client to your backend with url and proper path. In AWS lambda, you write your logic for POST as a function, which contains the logic to parse the data from request and send to dynamoDB. Now, this function can be exposed to world by connecting this function with API gateway( an another service in AWS). At the end we get an API, which can be used in your angular 2 APP. SO, on invoking the POST, angular 2 -> API gateway -> Lambda(extract request and send to DB) -> dynamoDB.
Benefits of using serverless compared to EC2.
You don't need to manage your server(EC2) from updating the new security patch to auto-scaling, everything is taken care by lambda. Serverless is a fully managed service.
You only pay when your lambda functions are invoked. On the contrast, even though your web app doesn't receive traffic for a given day, you have to pay the day-tariff for the given day.
Here is my github repo which could be a boiler plate for reactJS + Serverless + graphQL web app.
Having said, try serverless when compared to traditional backend approach. Any questions on this would be welcomed.