Image for post
Image for post
Liquibase integration with Spring boot

There used to be a time when we maintained database scripts separately.

Gone are those days, when we used to backup tables from one system and import it into yours, just to make the app run!

If you are here, you might have already heard of liquibase and flyway. Both are similar libraries, for DB Versioning.

Let's get started with liquibase.

Download:

Please fork the complete project from my Github.

Scope

The article will teach

  • How to create schema using liquibase
  • How to create table, and insert data using liquibase.
  • How to put liquibase tables, in your defined schema
  • How to write test units for Repository, when you have…

Image for post
Image for post
API Gateway with Cognito

This is the second part of the series. Make sure you have read the first. Here we will see how to deploy API-Gateway and best use Open API Spec.

API-Gateway

Importing Open API

  1. Get the Swagger Document (V2 or V3) for the service to be exposed.
  2. Create API → REST API (Import) → Paste the swagger document → Import

Swagger Document Troubleshooting.

  1. If you find any issues like

Request header “Content-Type” is not being sent with request #1361

Try adding

2. Try verifying the Swagger Document by pasting it in the swagger editor.

VPC Link

  1. Create a VPC Link for the NLB created earlier. …

Image for post
Image for post
ECS Service via API Gateway

Today, let's see how to expose ECS Service via API Gateway. If you are looking for a simpler solution to expose your service via HTTPS Authorized endpoint, please read Integrate Spring Boot Resource Server with Cognito Identity Provider.

This will be two-part series, where I will talk about

  1. Setting up the AWS ECS Services with NLB
  2. Using Open API spec to publish API-Gateway and more.

Without further ado, let's dive in.

Pre-Requisite:

This is written under an assumption, that you have some experience in AWS services like ECS, CFT, VPC, API-Gateway, Cognito etc.

Spring Boot Service:

Health Check

  1. Ensure that you have added health check dependency to your spring-boot service. …

Image for post
Image for post
Appsync + Amplify

We will be learning how to integrate Appsyn with an Angular 7 App using Amplify. In the previous tutorial, I have shared some insights on Appsync subscriptions. Let's get started.

Download:

Please fork the complete project from my Github.

Project Structure

Image for post
Image for post
Project Structure

Amplify Setup

  1. Refer to the amplify generic instructions mentioned in this article.
  2. In the aws-exports.js include the Appsync configuration as well.

Angular 7

1. services/graphql/API.service.ts

2. pages/dashboard

  • dashboard.component.html
  • dashboard.component.ts

Note: We have included functionality to unsubscribe subscribed function.

Queries on Vehicle

  1. To Create a Vehicle.
Image for post
Image for post
Create a vehicle

2. To Query a Vehicle.

Image for post
Image for post
Query a vehicle

3. To update a Vehicle Location.

Image for post
Image for post
Update Vehicle Location

Output

Image for post
Image for post

Initially when the App loads, we have the last known data of CAR4, in the GraphQL Query Section. When we push updates via mutate-function (updateVehicleLocation), the data is reflected in the GraphQL Subscribed Data Section. When you unsubscribe, the data is no longer updated in the Subscribed Data section. …


Image for post
Image for post
Appsync Subscription using WS

The major reason for trying out Appsync was to understand the benefits of Appsync realtime updates. In the previous article, we explore the Appsync AWS configurations in detail.

Background

We have already learned how to set up a subscription function which subscribes to updateVehicleLocation call. This subscription function accepts a particular ID and subscribes to the mutation happening(via updateVehicleLocation) to that ID.

State Subscription ( Query + Subscribe)

To subscribe to a state change, you need to make two calls in your web/mobile app.

  1. Query: To fetch the current/persisted state
  2. Subscribe: To get updates about the latest state changes.

Appsync + Amplify

They work well together. Amplify provides a functionality called offline sync. So data from Appsync can be cached locally for offline usage. When you are back online, only the delta changes are fetched from the Appsync. …


Image for post
Image for post
Appsync

If you are here, most likely you have heard about GraphQL. Appysync is an AWS Service built on top of Appollo GraphQL implementation.

This will be a multipart series where I show you:

  1. Intro to Appsync & AWS configurations
  2. Subscription in Appsync
  3. Angular 7 app integrated to Appsync

Without further ado, let's get started!

What is BFF?

Backend for Frontend(BFF) is the single general frontline API layer (Fascade) which our clients would be communicating to instead of making multiple API calls to fragmented microservices. …


Image for post
Image for post

In Part 1, we saw how to build uber/fat jar for our flink application. In this tutorial, we will cover how to deploy the app in KDA.

Pre-requisites.

  • Kinesis Stream
  • S3 Bucket
  • IAM Role

Kinesis Stream:

Let's create a Kinesis stream for feeding our Flink Application. You can also use Kafka or RabbitMQ as a source.

S3 Bucket:

Deployment of flink application jar in KDA requires an S3 bucket (to act as a repository). We upload our jar into this S3 bucket and then point the KDA source to S3 Object URL. Let name the S3 bucket as appname-kda-repository-bucket-dev .

IAM Role:

We need an IAM role which has only the right amount of access for our streaming job. We can set policies to limit the application access to particular kinesis stream etc. …


Image for post
Image for post
KDA+Flink

If you are here, you might have already heard of apache flink. It is primarily used for distributed stream processing/aggregation. Amazon Kinesis Data Analytics (KDA) is a PaaS, where you can run your flink application.

Tutorial List:

  1. Best practices for building your KDA Flink app. [Part 1]
  2. Deploying your Flink jar in KDA. [Part 2]

Download:

Please fork the complete project from my Github.

AWS Kinesis Data Analytics:

As mentioned, KDA is a Platform as a Service. KDA is Flink Cluster running on Fargate, which can scale based on the load. There is another way of running the flink app on AWS, which is by using EMR. …


Image for post
Image for post

Did you know that Postman can be used to automate API Calls? Also, there is a brother of Postman, called Newman, which can run the same automates from the command line. Let's see this thing in action.

Download:

Please fork the complete project from my Github.

Postman Environment variables

You may want to run your automates with a different set of data, based on region, environment etc. In this case, you can create your script to read input value from environment variables, so that these values are externalized.

Image for post
Image for post
Postman ENV variables

Update: (23/02/2020)

NOTE:

It is always, good to follow a naming convention for your Collection ENV. …


Image for post
Image for post
Deployment Architecture

We will learn how to deploy an Angular App in AWS S3 via CloudFront (With SSL). Will also deploy a REST backend in EC2 exposed via ALB.

AWS Service

  • EC2: We will host our spring boot app in EC2.
  • ALB: Since we need to enable SSL in the frontend, we need the backend also to have SSL. We will use ALB( since it very easy to set SSL)
  • S3: We use static website hosting in S3 to host our angular app.
  • Cloudfront: We use this to enable SSL & re-route rule for our S3 static website.
  • Certificate Manager: Used to issue self-signed SSL certificates via AWS. …

About

Arjun S K

Cooking ideas with code! 🔎 github.com/arjunsk

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store