1. create an AWS account, and login (all AWS service uses below are applicable to free-tier users)
- select your country & region to make sure the billing is correct
2. setup an EC2 instance
- Instance Type: t2.micro
- OS: Centos 7
- Subnet: choose anyone in the dropdown list, but remember to pick the same one when setting up the subsequent RDS instance
- Storage/Disk: select Magnetic or SSD, check the option of "Delete on Termination" to avoid extra charges
- Security Group: allow minimum rules for access, port numbers needed: 22, 8080, 5432
- Key Pair: download and change permission to 400
- Connection: using ssh with key auth
3. setup the RDS instance
- Instance Type: PostgreSQL (enable free-tier use only)
- Storage: 20GB by default
- DB instance identifier
- Master user name (username of a postgres db user)
- Availability: public
- Zone/Subnet: same as EC2 instance's
- Security Group: allow access of IPs that needs connection to this DB, eg. current IP, EC2's IP/Subnets(eg. 172.31.0.0/16), port 5432
- Database Name
- finish the setup
- edit the instance properties -> Parameter Group -> New -> put a group name -> changing the property of "max_prepared_transactions" to the value of 300
- connect to the RDS instance using ssh to test the db, command: psql --host=[your RDS instance's DNS] --dbname=[your database's name] --user=[your database's user]
- you may need to reboot the RDS instance to apply any immediate changes
4. Configure the EC2 instance, install software
- connect to EC2 using ssh & key pair using the centos user
- switch to root user
- change the instance timezone to reflect your region
- install Java 8, setup $JAVA_HOME
- install Apache Maven, setup mvn variables
- install Wildfly 11
- install git and folk the destined repository
5. Configure the git repository, and run it with Wildfly as a J2EE Project
- change the start_webapp.sh to let Wildfly's variables inside reflect your instance's configurations, mainly $JBOSS_HOME
- change Wildfly's standablone.xml for a datasource setting reflecting your RDS instance's, this includes the RDS's instance DNS, DB name, DB connection user name and password
- change the start_webapp.sh add -b 0.0.0.0 to allow public access to Wildfly server
- start Wildfly server using start_webapp.sh, and visit your project's home page through browser on port 8080
6. Stop the EC2 instance & RDS instance,
- you may also delete these in case further charges apply, remember to check your billing dash board for fees & credits incurred.
没有评论:
发表评论