Case Study – WIP Reporting and Timeline video on Completion

Requirements (My hallucinations):

Design and architect a highly available, large user base system which is going to be used by the National Highways, the regular employees updating photos of WIP on different stages and when work completed, archive all images after creating a timeline video. WIP sequence should keep the most latest photo thumbnail linked to a project blog page, with a gallery linking to last photo per day.  Post-processing of a completed work can take even up to a week giving more importance to the lowest cost possible. The system should be capable of handling hundreds of thousands of high-quality mobile photographs per day. Runtime costs should be as low as possible. For each WIP a minimum of one photograph in six hours is desired. 

Solution on AWS (My views):

Application to be developed in some kind of single-page-app with progressive-web-app support, javascript and CSS libraries. This can be hosted on AWS S3 bucket with Cloud Front default origin pointed here. The standard secure approach of https (Redirect HTTP to HTTPS), OAI and custom domain with certificate from ACM is recommended. Dynamic part uses Cognito User Pool, Amazon API Gateway (regional), Lambda, STS etc. API Gateway stage should be the behaviour point for route.

Continue reading “Case Study – WIP Reporting and Timeline video on Completion”

WordPress to Static – Pushing the limits

Well this is not a kind of DIY or hands-on, but just a note on how I am doing it. The architecture of this portal.

The process is as follows

  1. Write an email with the subject having title and a signature, checksum of title plus a predefined string, separated by a double semicolon
  2. Send the same to a virtual id on CloudMailin.
  3. That is routed to an API Gateway, which triggers a lambda.
  4. Lambda (Node.js) evaluates the signature.
  5. If signature is valid, write email json into s3 bucket and triggers an EC2 spot instance with an EBS Volume attached.
  6. The user-data is injected with startup and delayed startup to pick and post the article from S3 into the WordPress on EBS
  7. Inline images are stripped and uploaded into the media manager, and links are replaced appropriately.
  8. Custom scripts utilizing mirror-website and other cli tools will convert the www.jijutm.com website to a static site
  9. WordPress has S3 support for Media Manager through a plugin.
  10. Downloads are directly uploaded into a download bucket.
  11. Then site is synced to s3 with proper expiry headers
  12. CloudFront is invalidated using the aws cli command.
  13. The services are stopped internally and EBS is unmounted
  14. Finally, the EC2 instance is terminated.

The EBS volume was prepared with the data, html and server configuration files. The spot instance is created from a custom ami which is updated time to time and provided to the lambda through environment variables.

This will run for me since I am the sole author of this blog, and my frequency of posting is very low hardly once in two months. For a high frequently updated portal or blog, this process may even fail totally and if there are more than one author, don’t even think of this. I do agree that there are too many cons, like preview editing, making changes etc are not there. But the most important part for me is this WordPress blog is rock solid, Not Hackable, unless AWS S3 or CloudFront is Hacked. Also page load times are pretty good, though tools like google lighthouse or webpage test are still suggesting more improvements.

Podcasting Solution on AWS

PodCasting – on AWS can be damn cheap while being ready for a bigbillion hit…

Ingredients..

  1. Amazon S3
  2. Amazon Lambda ( S3 Events [and @ Edge ( if not authenticating from Cognito) ] )
  3. Amazon CloudFront
  4. Amazon Route 53
  5. Amazon Cognito ( optional if social login is required )
  6. A pinch of html and some javascript ( will be provided by me )

S3 stores raw files in one bucket, and trigers lambda to do the transcoding, if mobile from any format to mp3. Meta information should be uploaded to same bucket as flat file. Also multiple quality files will be generated. Interface will upload meta.json and pod.raw files to S3 bucket.

Continue reading “Podcasting Solution on AWS”