The serverless architecture for Pulse will see the following flow:

  • Users will reach the home page running on S3
  • The web application static content will be loaded via S3
  • The dynamic content will be managed by Javascript via invocation of APIs on the AWS API Gateway
  • Dynamic behaviour triggered via APIs will be executed by Lambda functions which, in turn, will use AWS services to get things done (e.g. DynamoDB for access to data and so on)
  • Frontend content will be served via CloudFront for optimised performance

The first thing I need to therefore do is to create a S3 bucket on AWS. I created a S3 public in the London region named: mtedone-pulse-serverless. I then set the bucket permissions to host a static website and made all content public.

As a result, the following URL now points to some static content:

At this point I don’t care too much about what the static website contains, as long as the index is visible and I can confirm that the Bootstrap content can be seen. A quick look at the page confirms this.

I created the skeleton bootstrap content by using the Bootstrap plugin for Webstorm, which is the IDE I’m using to create the content. I then copied and reformatted parts of the content of my existing website into the skeleton to obtain the result you can see now. I had to make some modifications because in its original Microservices form the content used Thymeleaf which is obviously not available in a static HTML/Javascript page.

Making the bucket content public via a policy

Now we can apply a policy at the bucket level to make all content publicly accessible. The policy looks like the following:

    "Version": "2012-10-17",
    "Id": "Policy1497053408897",
    "Statement": [
            "Sid": "Stmt1497053406813",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::mtedone-pulse-serverless/*"

Of course if you’re following along make sure that you change the bucket name to your own one.