1
votes

I'm trying to understand how to use the EC2 AWS services so I've developed a dynamic website using Node.js and Express. I'm reading the documentation but people's advice are always useful when learning new stuff.

In this website users can upload photos so I need storage space (SSD would be better).

I have three questions:

1) Is storage provided in the EC2 instance or do I have to use another AWS service as S3Bucket? What's the best/fast and less expensive solution to store and access images?

2) I'm using a t2.nano which cost $0.0063 per hour. So if i run the instance for 10 days my costs are 24hours * 10days * 0.0063?

3)I'm using mongoDB, is a good solution to run it on my EC2 instance? Or should I use the RDS provide by AWS?

1
Unless your an enterprise DON'T use RDS it's stupid expensive, answer coming up. - Mrk Fldig

1 Answers

1
votes

So:

1) Personally I'd use an S3 bucket to store images, note if you have multipart uploads in the S3 bucket, if one fails it'll not only not show on the object listing, it'll still use space. There's an option to remove them after a certain period.

When you add an object s3 you want to store it's key in your database, then you can simply retrieve it as required.

2) t2 nano is on free tier - so technically you can run it for nothing for the first year.

3) Personally i'd set Mongo up to run on an appropriate EC2 instance, note: you must properly define the Security group, you only want aws internal applications and services to access the EC2 instance, you'll need SSH access to configure it, but then I'd remove that rule from the security group.

Once your Mongo instance is setup, take an AMI so that should anything go wrong you can re deploy it configured(note this won't restore the data).

Aws pricing calc here for EC2 the easy way is to calculate it at 100% usage, the other stuff can get a bit complicated but that wizard lets you basically price up your monthly running costs.

Edit: checkout this comparison on the different storage options for S3 vs X for storing those images although your "bible" should be that pricing calculator - I'd highly recommend learning how to use it as for your own business it's going to be invaluable and if your working for someone else it'll help you make business cases.