2015年6月19日 星期五

AWS EC2 Build Tomcat And Single MongoDB


EC2

1.註冊

2.進到console home後,選Region

3.Launch Instance 

Key Pairs
  1. 產生[name].pem,並下載,登入時要用

Security groups

  1. 增加SSH TCP 22 PORT

會自己建立一個VPC

4.產生後,回到Instances 頁面

  1. 就會新增剛才建立的,可選上方的Connect,可以用 ssh [ubuntu]@[public_ip] -i $PATH/[name].pem 來登入


5.登入後,安裝tomcat, 放程式

sudo apt-get update
sudo apt-get install tomat7

  • /usr/share/tomcat7
  • /var/log/tomcat7
  • /etc/tomcat7

sudo service tomcat7 start
sudo apt-get install default-jdk
sudo apt-get install maven
git clone https://xxx@code.google.com/p/projectname/
git pull
./sudo mvn clean
./sudo mvn install
sudo vim /etc/tomcat7/server.xml

Mongodb

1.可由Launch Instance選擇AMI 或 Service -> CloudFormation 使用template來建立

先簡單化,這裡使用template, 並安裝在原來的VPC上,
且Replica Set只建一個

安裝過程中
Subnet-xxxxxx 要輸入 Network Interface 頁面裡 同一個VPC所對應的Subnet ID

會產一個新的instance

同樣方式連進去
ssh [ubuntu]@[public_ip] -i $PATH/name.pem

登入後,執行command

mongo
config = { _id: "r0", members: [ { _id:0, host:"127.0.0.1:27017" }] }
use testdb
db.createUser("root","password")

Send Email

選Service -> SES -> SMTP Settings
1.Server Name
2.Create My SMTP Credentials 要認證過的email,才收的到信
3.上線前,需於Support Center寫信給官方,才能離開sandbox

Ref

April 2015 





1 意見:

rmouniak 提到...

Thank you for your guide to with upgrade information about
AWS keep update at AWS Online Course