A personal picture repository in cloud. This application provides secure, highly available, reliable and scalable storage for your snaps. This is enterprise level application to support HTTPS and single sign-on.
- Agenda
- Features
- Technologies Used
- Architecture diagrams
- Application Screenshots
- How to Run
- AWS Infrastructure Detail
- Licence
- Refrence
Basically this application demonstrates Azure Active Directory Single Sign-On Authentication, CRUD operations with AWS RDS MySQL, File storage with AWS S3, File download from AWS CloudFront with AWS SDK for .NET with .NET Core, ASP.NET Core MVC, JQuery, Bootstrap, Pomelo.EntityFrameworkCore.MySql.
- Name: CloudJibe – SnapBox: Personal picture repository
- Provides Enterprise Level Azure Active Directory Single Sign On Authentication
- Secure highly available and scalable personal picture storage solution for employees
- Globally accessible. Individual roles restrict others to see your pictures.
- Picture metadata is stored in MultiAZ AWS RDS. User data is default populated from Azure AD.
- System allows jpg and png files to upload of max size of 10 MB.
- User can browse already uploaded pictures.
- User can update picture metadata or can replace picture too.
- User can delete file.
- System sends notification email on picture deletion using Lambda and SNS topic.
- System keeps track of picture meta data like First Name, Last Name, Upload time, Updated time, Picture description.
- System provides list of pictures with link to download.
- System is deployed in Multi AZ Auto scaling environment.
- RDS is set to Multi AZ Deployment
- RDS is maintaining read replicas
- S3 is set for multi region replication with life cycle as in object storage diagram. Transfer acceleration is enabled for faster file transfer rate.
- Cloud from is set for caching and faster file downloads at edge locations.
- CloudWatch Alarm is set with SNS topic email notification on Elastic Beanstalk network traffic crosses threshold traffic.
- Site is also configured for HTTPs. Secure login using HTTPs
- Using Azure and AWS cloud platforms.
- ASP.NET MVC Core (latest open-source and cross-platform framework)
- JQuery, JSON, Javascript – Client side scripting
- HTML5
- CSS3 - Styling
- Bootstrap – to make responsive UI
- Bower js web package manager
- NuGet - Package manager
- Bundling and minification – To boost performance doing js file bundeling and minification
- GitHub – For configuration management
- Pomelo.EntityFrameworkCore.MySql - ORM
- AWS SDK for .NET Core – To communicate to AWS services.
- Azure AD – Enterprise user data for authentication
- Azure AD Federation Authentication – For Single Sign on.
- Elastic Beanstalk – Used for multi-AZ and auto scale deployment.
- EC2 – Auto scale “64bit Windows Server 2016 v1.2.0 running IIS 10.0” EC2 instances are used.
- ELB – used for load balancing
- Lambda – used to send mail on image deletion.
- AutoScaling Group – Multi AZ deployment is set for auto scalling
- Single AZ RDS Db converted to Multi AZ Select InstanceInstance ActionModifyMulti AZ deployment to Yes.
- CloudFront – caching for faster file download.
- S3 for object storage
- S3 Transfer Acceleration
- R53 – domain registration, URL configuration
- CloudWatch – log and notification
- SNS -- Notification
- IAM – Permissions/role/group
Main List Page: In this page user can see list of images. which are stores in AWS S3 and metadata in AWSS RDS MySQL DB.
Upload image and Create image metadata Page: In this page user can upload picture and set metadata in subsequent page.
Edit Page: In this page user can update metadat of image and can also replace it. Validation is inplace to keep file name same to replace.
- Visual Studio 2017
- Clone project and open in Visual studio 2017
- Enter your RDS MySQL database connection string in Startup.cs file line # 29.
- Place IAM.json file in root folder where Startup.cs is there. This file will have you AWS profile information. Sample is as follows.
[local-test-profile]
aws_access_key_id=XXXXXXXXXXXXXZX
aws_secret_access_key=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
region=us-west-1
- Set up AWS infrastructure
- Setup Azure AD (Will cover in another article for How to)
- Now run your application
- This project is deployed on AWS Elastic Beanstalk on Multi AZ servers with load balancer and autoscaling.
In AWS following 3 are the main technologies which are required to run App. However I used more to make secure, highly available, reliable and scalable application.
- Create S3 bucket with name as “homework2-manoj”. Enable versioning and transfer acceleration. Lifecycle can be set as architecture diagram to save cost. I also set permissions, user and group in IAM.
var AWS = require('aws-sdk');
var sns = new AWS.SNS();
console.log('Loading function');
exports.handler = (event, context, callback) => {
var srcBucket = event.Records[0].s3.bucket.name;
// Object key may have spaces or unicode non-ASCII characters.
var srcKey =
decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, " "));
console.log(
'Successfully resized ' + srcBucket + '/' + srcKey
);
var params = {
Message: 'CloudJibe portal iniciated filedeletion for file - ' + srcBucket + '/' + srcKey, /* required */
MessageStructure: 'STRING_VALUE',
Subject: 'File ('+srcKey+') deleted in S3 from CloudJibe portal',
TopicArn: 'arn:aws:sns:us-west-1:476374:manojalb_health'
};
sns.publish(params, function(error, data) {
if (error) console.log(error, err.stack); // an error occurred
else console.log(data); // successful response
});
//console.log('From SNS:', message);
callback(null, 'Successfully resized ' + srcBucket + '/' + srcKey);
};
- Create RSD MySQL database. Run following script to create table.
CREATE TABLE FileUpdate (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
firstname VARCHAR(30) NOT NULL,
lastname VARCHAR(30) NOT NULL,
email VARCHAR(50),
upload_date datetime,
updated_date datetime,
file_name VARCHAR(50),
file_desc VARCHAR(100)
)
The SnapBox – By CloudJibe is licensed under the terms of the GPL Open Source license and is available for free.
- University Name: http://www.sjsu.edu/
- Course: Cloud Technologies
- Professor Sanjay Garje
- Manoj Kumar (https://www.linkedin.com/in/manojkumar19/)