3

I want my server to connect to a db server (both on an EC2 instance). How can i give the db server a static IP address to use within EC2 without using VPC?

1
  • 1
    Just use a VPC. Hell, it's the default for new accounts. Takes an extra five minutes to set one up and comes with all sorts of benefits.
    – ceejayoz
    May 1, 2014 at 15:35

1 Answer 1

4

Elastic IPs are the only way without using a VPC. You can use a Security Policy to restrict all public traffic so you'd essentially have a private IP address (plus, these are free).

Edit: As pointed out by @ceejayoz, this incurs Internet bandwidth fees and is not the recommended method. Unless you absolutely cannot use VPC for some reason, use it. Otherwise, use the "internal" EC2 assigned IP or static as a last resort.

7
  • 1
    Elastic IP is a fixed public IP. I don't think it gives you a fixed private one. DB traffic over a public IP will suck.
    – ceejayoz
    May 1, 2014 at 15:35
  • @ceejayoz Traffic is still routed like it was private. I had two instances once with static IPs, and they were one hop from each other provided they were in the same zone.
    – Nathan C
    May 1, 2014 at 15:37
  • @ceejayoz But I agree with your statement...VPC is the de-facto way.
    – Nathan C
    May 1, 2014 at 15:38
  • Nathan, per the EC2 docs, "Instances that access other instances through their public NAT IP address are charged for regional or Internet data transfer, depending on whether the instances are in the same region." Definitely not the same on a billing basis, and that's likely because they're not the same on a technical basis too.
    – ceejayoz
    May 1, 2014 at 15:45
  • 4
    Referencing the elastic ip by its dns name will resolve to the internal ip where possible avoiding data transfer charges. May 1, 2014 at 22:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .