Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
349 views
in Technique[技术] by (71.8m points)

deployment - Deploy Rails Application on EC2

For the past week, I've been playing with the Rubber gem and can't seem to get it to work. I've decided it would be easier just to manually set up my EC2 instance. The problem is that I don't know how. Google hasn't been much help for a newb either. Any suggestions? It really is appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Sure.

  1. Create a AWS account.

  2. Decided what region you want to be in. Lots of things go into this decision, but worry about it later and just do a cheap one like Oregon or East.

  3. Make sure you are in the correct region at the top left.

  4. Then click launch server.

  5. At this point you have to pick a AMI. An AMI is basically the template you want to use when you boot your server. Amazon gives you some, but there are a ton in the community section. I am a CentOS guy so I usually search for a CentOS AMI. RightScale makes some good ones so you can search for one of those. Make sure you pick i386 or x64 depending on the size of server you want. There are two distinct types of AMI's, EBS backed and S3 backed. Really you should stick with EBS because you have some more freedoms, but there are reasons to use both that are beyond the scope of this answer. Look for EBS and you probably will be good. EBS is the block storage. Basically it is attachable harddrives for your instances. Since everything in the cloud is "virtual" and nothing is thought of in a physical sense, you have to think that way too. So if you want more storage, you can attach some EBS volumes later. One thing though, S3 backed instances go bye bye when you shut them down. The EBS ones will too if you have the delete on termination flag set, but with EBS ones you can "Stop" them as well as "Terminate" them.

  6. Select the size and availability zone. The zone is important if you are going to be setting up some kind of redundancy. Like if I have a master slave setup with MySQL I would put the master in one zone and the slave in another in case Amazon was having troubles that were isolated to one zone. But for this general purpose, don't worry about it.

  7. Advanced Instance Options. Just leave all this alone most likely it is fine. Some of the small things here you can set later like termination protection.

  8. Name it. Whatever.

  9. Make a SSH key. Striaght forward. The only way to login to an Amazon server will be with the SSH key you assign it. There are no user names or passwords.

  10. Security Groups. This is where you could get tripped up, well here and #5. But you should start off with creating a general security group call foo or whatever then adding the ports you want open on it. So if you want to ssh into it, which I assume you do, then open 22. If you want to use it for web then open 80 and 8080 or whatever. But be careful. I usually change my SSH port later to something random. And instead of putting 0.0.0.0/0 on it, I put my personal ip. But if you don't care that much just put 0.0.0.0/0 and open that bad boy to the world.

Then it will boot. As long as it all went as it was supposed to.

Now you can login. Just ssh -i thekey.pem thenwholehostname

Hope that helps.

There is this whole free tier you can use. http://aws.amazon.com/free/

Check that out. I would use that while you play with it.

I did all that from memory so I could have been off. ;)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...