bob_cobb
bob_cobb

Reputation: 2269

Issues trying to deploy MongoDB to EC2

I created a micro instance on EC2 that has my node.js based web application along with nginx (created a reverse front-end proxy so that my app can be on port 3000, and I have that routed to my localhost with nginx).

I also installed mongodb on this same (micro) instance, however, I was reading last night from the MongoDB docs on the way to deploy MongoDB on EC2 here. The difference between this method and my initial method is:

  1. This method uses the ec2 command line tools to create new instances
  2. When I use the ec2 command line tools to replicate the instructions, it tells me that it's ignoring one of the flags, so I think that the following command is outdated: $ ec2-run-instances ami-05355a6c -t m1.large -g [SECURITY-GROUP] -k [KEY-PAIR] -b "/dev/sdf=:200:false:io1:1000" -b "/dev/sdg=:25:false:io1:250" -b "/dev/sdh=:10:false:io1:100" --ebs-optimized true
  3. After using the above command, and proceeding to do: sudo mkfs.ext4 /dev/sdf, the name changed on my AMI image since it doesn't live there anymore.

  4. After running ec2-run-instances and refreshing my Amazon EC2 dashboard, it doesn't show up in my instances, but if I do sudo fdisk -l it'll show 2 mounts.

As you can see, the guide is probably a little outdated, and I'm just wondering how in the world to deploy my mongodb to EC2 on its own instance. From there, how do I get them to talk to each other too? E.g. my new mongodb instance to talk to my node.js micro instance with nginx on it.

Upvotes: 0

Views: 353

Answers (1)

albert
albert

Reputation: 66

Try to add the volumes from EC2 panel, and then attach them to an existing instance. It works for me.

The command line is

-b "/dev/xvdf=:200:false:io1:1000" -b "/dev/xvdg=:25:false:io1:250" -b "/dev/xvdh=:10:false:io1:100"

and

"/dev/xvdf=:200:false:io1:1000" 

means that

1, you have to add a Provisioned IOPS (PIOPS) EBS volume.

2, volume size should be 200, and IOPS value is 1000, the available zone should be as same as your ec2 instance.

3, And xvdf is the location you add when you attach the volume to the instance.

Upvotes: 2

Related Questions