Web Application Code Repository
Application Use Cases:
- Application manages Billing invoices for the customer
- Users and Bills records are saved in MySQL RDS Instance
- Bill related files are uploaded to Amazon S3 bucket with lifecycle policy of 30 days
- Bill file metadata is stored in RDS Instance itself for retrieval purpose
- User receives his due bills in email via AWS Simple email service
Tools and Technologies
Category | AWS Services & Technologies |
---|---|
Web Application | Java, MySQL, Hibernate ORM,Shell Scripts, AWS-SDK |
Infrastructure | VPC, ELB, RDS, Lambda, DynamoDB, Route53, Cloud formation |
Metrics & Logging Service | statsD, AWS Cloud-Watch, Log4js, Cloud-Watch Alarm |
Queue & Notification Mechanism | SQS, SNS, Lambda, SES, |
CI/CD Pipeline | Circle CI, AWS Code Deploy, AMI Automation |
Security | SSL/TLS , RDS Encryption |
- created custom VPC with network setup using cloud formation template
- Attached Load balancers, auto scaling groups, SES, SQS and SNS services
- Created necessary service roles and policies for AWS resources
- Implemented Lambda function for emailing service
HashiCorp Packer Code Repository
- Automated AMI creation using Hashicorp packer
- Created AMI template to share the image between multiple AWS accounts
- Created golden images by adding provisioners to boostrap instances with - NPM, Code deploy and Cloud watch agaent
- Integrated Github repository with Circle-CI for continuous Integration
- Bootstrapped circle CI container with docker image to run the test cases and generate new code artifact
- Artifact is copied to S3 bucket and code deployement is triggered on running instances of autoscaling group
- In-Place deployment configuration hooks are placed for routing the traffic during deployment
- Embedded statD to collect various metrics such as counter for APIs hits and API response time etc
- logged the info, errors and warnings using log4js and further mounted them in AWS cloud-watch for analysis
- Implemented CPU Utilization based alarms for changing number of instances in auto scaling group
Serverless Lambda Code Repository
- Implemented pub/sub mechanism with SNS and Lambda function
- user requesting for his due bills, puts a message onto the AWS SQS service
- SQS-Consumer in the application checks already existing entry for user in Dynamodb
- If no email has sent already, SQS consumer process the request and puts the response in SNS
- Once message is published to SNS Topic, subscribed lambda function is trigged
- Lambda delivers due bills email to requesting user and saves the entry in Dynamo DB with TTL of 60 minutes
******* Billing & Invoicing System *******
API Impementation with Spring Boot
Programming language : Java
External Libraries used:
- UUID - for generating id fields
- Bcrypt - for hashing out the passwords
- basic-auth - Authentication module
- Hibernate - ORM for Java
- mysql - dialect for hibernate
- mockito - for integration testing in java
Build & Deployment The application runs on AWS Cloud EC2 instance and is deployed via CircleCI pipe-line. As sson as there is a merge take place to the webapp repository, the build gets triggered and deployment takes place in AWS account.
Environemnt variables need to be configured in CircleCI pipeline are
- AWS_SECRET_KEY
- AWS_ACCESS_KEY
- CODE_DEPLOY_BUCKET
- AWS_REGION
Command to import the SSL certificate for LoadBalancers
sudo aws acm import-certificate --certificate fileb://certificate.pem --certificate-chain fileb://certificate_chain.pem --private-key fileb://mysslcertificate.key --profile prod
Steps
- Clone the repos locally
- Install maven dependenices using 'mvn clean install -Plocal'
- Run the application using following command 'java -Dspring.profiles.active=$springprofilesactive -Ddb.url=$dburl -Ddb.username=$springdatasourceusername -Ddb.password=$springdatasourcepassword -Dbucket.name=$bucketname -jar demo-0.0.1-SNAPSHOT.war'
- Test whether appliation is running or not at (http://localhost:8080/)
Run the unit test cases
mvn test
Author: K.A Sai Swagath
Email: kalpatiananthakris.s@northeastern.edu