Database and Document Storage Setup

> Quick overview of the AWS services we used or planned to use:

	- I highly recommend following any AWS basics tutorial if no experience. ACloudGuru's is popular, but most others are enough to get started.- Create AWS Free Tier account using credit card credentials.
	- I recommend AWS Elastic Beanstalk (Includes EC2,RDS,S3,and more) if you expect to host the server on the cloud (EC2). Elastic Beanstalk would automate 
	  the setup of many of the AWS services. 
	- The following below are some descriptions of the most useful services.
	- DATABASE: AWS RDS for PostgreSQL database. 
		- Most recent version.
		- t2.micro instance class is cheapest and sufficient.
		- Will need username, password, db name, and db endpoint for connection with server.
		- Make publically accessible for simplified setup.
	- DOCUMENT STORAGE: AWS S3 bucket for storing documents (PDFs) of items on the cloud.
		- Select S3 Standard. Keeps objects durable, stable, and immediately available.
		- Enable version controlling, through AWS S3 selected bucket properties. 
		- Will need an Access Key and Security Key generated through AWS IAM
		- Make publically accessible for simplified setup.
	- AWS IAM (Identity and Access Management) for permissions and access among team members and AWS resources. 
		- Create IAM user accounts and passwords with rights to access AWS services like S3 and RDS for all developers.
		- You don't want to login as root account frequently. 
		- Activate multi-factor authentication (with Google Authenticator on phone) on the root account for more security. 
		- Save root login information somewhere secure. 
		- Create account alias so that console login is simple. e.g. fiu-agda.signin.aws.amazon.com/console
		- Make sure every user is aware of their region. They may not be able to locate a RDS DB if on wrong region for instance.
		- Generate Access Key ID and Secret Access Key for at least 1 user to use for S3 bucket access.
	- AWS CloudWatch to monitor and set alerts for AWS resources to avoid unexpected charges. 
		- AWS requries credit card information to signup therefore you should set email billing alerts.
		- Review up-to-date Free Trial account limitations.
	- AWS Route 53 can be used to purchase domain names once you're ready to deploy.
	- AWS EC2 (Elastic Compute Cloud) servers on the cloud using virtual machines.

> Once AWS Services (Specifically RDS and an S3 bucket) are prepared:

	- CREATE TABLES ON RDS DATABASE: 
		- Open PGADMIN (or similar software), connect to RDS DB.
			- Hostname is the DB Endpoint found on AWS RDS database view.
		- Use provided CREATE TABLE sql from 'agda-db-1.0.sql' to create the tables using the query tool.
	
	- FOR ACCESS TO RDS DB AND S3 BEFORE INSERTING DATA:
		- Modify 'database-info.json' in project folder with accurate information.
			{
				"dbUser":"username",
				"dbHost":"endpoint.here.us-east-2.rds.amazonaws.com",
				"dbDatabase":"dbname",
				"dbPassword":"password",
				"dbPort":5432
			}
		- Modify 's3bucket-info.json' in project folder with the bucket name, IAM Access Key and Secret Access Key.
			{
				"bucketName":"fiu-agda-bucket-name",
				"aKey":"accesskey",
				"secretKey":"secretaccesskey"
			}
		- IMPORTANT: Add both files to .gitignore as to keep that information secure.
		- In the future, this information should be put...

	- ADD DATA TO RDS DATABASE:
		- For TYPE and USERS table, use provided INSERT sql from 'insert.sql'
			- Open PGADMIN (or similar software), connect to RDS DB.
			- TYPE table values provided by MDC ITD.
			- Insert Users <Cristian>
		- For MATTER and HISTORY table, use POSTMAN to insert Matters
			- Reason: So entire process of generating pdf, uploading to s3, and history recorded is done
			- Open POSTMAN, import provided 'AGDA-POSTMAN.postman_collection.json' file
				- 'POST SUBMIT NEW ITEM' = POST for http://localhost:4000/api/item/create/submit to create item
				- Body, use raw JSON
				- Provided example JSON on 'insert.sql'
			- Another option is to just run the application and create/edit items.

	- Database diagrams are available on Database/diagrams, including the schema and attribute domain.
	- The database schema was based on the provided ITD schema, modified to the needs of this application.
	- The database schema diagram was created with app.quickdatabasediagrams.com

		