I have a devops automation environment. Each successful build (web app) in Jenkins triggers a creation of EC2 (Linux) instance in AWS which is set to receive public IP and the app gets deployed on that instance. I'm calling the web application using instance's public IP. I need to mask the IP and call the app by custom name. I have created a subdomain on Route 53 subdomain.abc.com. I have three set of web apps and want to call them like one.subdomain.abc.com, two.subdomain.abc.com etc.
Since each time we have a different VM I'm not sure if EIP is an option.
Can someone please suggest a solution ?
Many thanks in advance.
If you are using just one Amazon EC2 instance for each app, then for each app you can:
Create an Elastic IP address that will be permanently used with the app
Create an A record in Amazon Route 53 to point to that Elastic IP address (eg app1.example.com)
When a new instance of the app is launched, re-associate the Elastic IP address with the new instance (assuming your old instance is then terminated)
If you wish to serve traffic from app1.example.com to several Amazon EC2 instances, then create an ALIAS record in Route 53 to point to an Elastic Load Balancer and register the EC2 instances with the load balancer.
Related
Recently somebody manually deleted all Elastic Load Balancers on a AWS account I am working with. All the Load balancers had been provisioned from Elastic Beanstalk configs.
I rebuilt all the Elastic Beanstalk instances from previous configs to restore the deleted load balancers. The various applications are now running correctly apart from 2 which are failing to send traffic to each other. I will call them App A and App B.
App A is sending traffic to App B using its elastic beanstalk URL, however the messages are failing to send. If I SSH into App A, I can manually send JSON messages to App B using CURL and the EC2 private IP. When I ping the EB URL from App B, it shows me a IP to do not recognise and which is not allocated to any EC2 instances running on the account.
App B is in a private subnet with a network load balancer.
How can I get the Elastic Beanstalk URL to point at the correct IP.
I have recently inherited this environment and did not configure the original setup. So perhaps I am missing a step or aspect of how AWS Elastic Bean stalk is intended to work in this regard.
Additionally I am certain this is not a programmatic error ( the code has not changed since the instances where rebuild ) or a firewall setting as I am manually able to send traffic and get a response with a curl script.
Its is the beanstalk URL which appears to be incorrect
I am running a Spring Boot Application (as a RESTful Webservice) dockerized in an EC2 Instance. If I start the container, everything is working fine, but only with HTTP. e.g. http://ec2-54-93-55.eu-central...com
I already tried setting up the Security Groups of my EC2 Instance, where I enabled HTTPS, but it still does not work.
Now I want to add a SSL Certificate to my Instance with the AWS Certificate Manager. The problem is now, that I need a hosted domain for this and I can not use the Domain of my EC2 Instance.
I tried setting it up as api.mydomain.com and it is verified now. How can I now connect my EC2 Instance with this domain?
I tried creating an Alias in Route 53 by routing api.mydomain.com to the EC2 public DNS. But this did not work too.
You will not be able to attach an ACM public certificate to your EC2 instance as they are required to be attached to either one of these resources:
CloudFront
Elastic Load Balancer.
Once these are configured you will need to update the DNS record on your hosting provider to target the CNAME of whichever of these resources they use.
If you were using Route 53 as your hosting provider you would add your record to the public hosted zone for that domain, however this process is slightly different for each DNS provider.
I have an issue that I have been trying to work out for a while now. I am experimenting with AWS and thinking of moving sites over, but I can't get DNS to work with OpsWorks apps. I have a PHP / RDS stack that I have a few apps in.
These were working great except for the issue of OpsWorks instances having a dynamic DNS that changes upon instance reboot. I don't want to have to change my DNS records in Route53 every time that happens, so I implementated an EIP, registered it with the instance, and registered it with OpsWorks. I added rules to the policy that the EC2 uses for default VPC to accept incoming HTTP requests as well.
Now, when I add an A record to my DNS zone that points to the EIP, and add my domain in the OpsWorks app settings, my domain does not resolve in the browser. What am I missing?
OpsWorks does very little to manage DNS externally. All DNS management should be done through Route53.
To start, make sure you have your nameserver (NS) record properly configured to reference your domain in your hosted zone, and also make sure that whatever DNS provider you're using (e.g. name.com, etc) is configured to point to those DNS servers.
Also, regarding this point:
I don't want to have to change my DNS records in Route53 every time
that happens, so I implementated an EIP, registered it with the
instance, and registered it with OpsWorks.
You should really be using an elastic load balancer for this, not an elastic IP. You can associate an elastic load balancer with your OpsWorks stack so that any instances launched within the OpsWorks stack will be associated with that elastic load balancer. The additional benefit is that you can have multiple servers hosting your application as you scale.
I have a root domain like example.com. It's now hosted on Amazon S3. For that I followed this tutorial:
http://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html
What would I have to do to have a subdomain like client.example.com to point to a EC2 instance?
client.example.com => ec2-XXX.us-west-2.compute.amazonaws.com
Is there like a tutorial out there explaining the steps?
Two simple steps:
You would just need to add a new 'A' record to assign the ec2 ip address to that subdomain in your amazon route 53 dns (or whatever dns provider you are using) - very simple to do. Step one will have requests for that sub-domain routed to the ec2 instance.
Step 2 is to tell the web server you are running, when it receives a requests for that sub-domaain, what website should it serve up to the user - you do this by 'binding' the name to the directory/location thast has the website on your ec2 instance.
You may also want to read over the following from AWS
http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-ec2-instance.html
It would also be better practice to assign your EC2 instance an Elastic IP address then forward requests to that IP.
We recommend that you also create an Elastic IP address and associate
it with your Amazon EC2 instance. An Elastic IP address ensures that
the IP address of your Amazon EC2 instance will never change.
I have a Rails app deployed successfully with Elastic Beanstalk, but each time I'm git aws.push, the end result is a new instance with a new Elastic IP, which is not the one I've assigned to my domain name.
So I have to go through this rig-a-ma-roll of allocating the old one to the new instance. Or alternatively, changing the DNS to point to the new Elastic IP, and then off course, delete the unused Elastic IP so I'm not charged by Amazon.
Can this new Elastic IP creation be prevented in a configuration?
If you use a load balanced environment, your domain should be pointing to the load balancer, so i assume you are on a single instance environment. In this case, you can use .config files and aws cli to automate the DNS record change (see http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html). Another alternative would be to launch the environment in a VPC and attach an ENI with a fixed IP to the instance, that could avoid DNS caching issues.
But considering the ELB costs, i would not go that far, just launch a load balanced environment with a single instance and register that ELB in DNS (an ALIAS record, if you are using Route53).