Using AWS Fargate as web server












5















Using AWS Fargate, the process to get a custom Docker container running on AWS ECS is relatively straightforward.



I was able to successfully test my container over the public IP assigned to the network interface of the VPC that the Fargate cluster is hosted in; the container is a simple HTTP server listening on 0.0.0.0:80.



I have also recently purchased a DNS domain using AWS Route53.



Now, I want to assign the DNS to the ECS service so instead of sending the request to a random IP address (which also changes with each update of the ECS service) I want to be able to send my requests directly to the root of my domain.



How can I achieve that?










share|improve this question





























    5















    Using AWS Fargate, the process to get a custom Docker container running on AWS ECS is relatively straightforward.



    I was able to successfully test my container over the public IP assigned to the network interface of the VPC that the Fargate cluster is hosted in; the container is a simple HTTP server listening on 0.0.0.0:80.



    I have also recently purchased a DNS domain using AWS Route53.



    Now, I want to assign the DNS to the ECS service so instead of sending the request to a random IP address (which also changes with each update of the ECS service) I want to be able to send my requests directly to the root of my domain.



    How can I achieve that?










    share|improve this question



























      5












      5








      5








      Using AWS Fargate, the process to get a custom Docker container running on AWS ECS is relatively straightforward.



      I was able to successfully test my container over the public IP assigned to the network interface of the VPC that the Fargate cluster is hosted in; the container is a simple HTTP server listening on 0.0.0.0:80.



      I have also recently purchased a DNS domain using AWS Route53.



      Now, I want to assign the DNS to the ECS service so instead of sending the request to a random IP address (which also changes with each update of the ECS service) I want to be able to send my requests directly to the root of my domain.



      How can I achieve that?










      share|improve this question
















      Using AWS Fargate, the process to get a custom Docker container running on AWS ECS is relatively straightforward.



      I was able to successfully test my container over the public IP assigned to the network interface of the VPC that the Fargate cluster is hosted in; the container is a simple HTTP server listening on 0.0.0.0:80.



      I have also recently purchased a DNS domain using AWS Route53.



      Now, I want to assign the DNS to the ECS service so instead of sending the request to a random IP address (which also changes with each update of the ECS service) I want to be able to send my requests directly to the root of my domain.



      How can I achieve that?







      domain-name-system amazon-web-services aws-fargate






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 3 at 22:41







      Markus Appel

















      asked Mar 3 at 22:27









      Markus AppelMarkus Appel

      1285




      1285






















          1 Answer
          1






          active

          oldest

          votes


















          10














          Your website visitors are not supposed to talk directly to the Fargate container. As you realised the IPs are not predictable and can change at any time - it’d be difficult to keep the DNS up to date.



          Instead use Application Load Balancer in front of Fargate and use the ALB’s address for your website.



          ALB will automatically register the Fargate containers as they come and go.



          Hope that helps :)






          share|improve this answer


























          • Okay, I was just testing the same, but with a Network Load Balancer. It works using the Amazon-provided domain. I also added a record to the public hosted zone that comes with the domain in Route53 (The hosted zone's name is the domain name followed by a dot) to redirect requests of type A to my load balancer. When I test the record it returns the correct IP - but in my browser the server couldn't be found. Do you know why?

            – Markus Appel
            Mar 3 at 23:06













          • @MarkusAppel Nope I don't know why. I would need more details about what's in your zone. Dare to share the actual domain name?

            – MLu
            Mar 4 at 0:33











          • I actually got it working, deleting and recreating the record set resolved the issue - almost looks like a bug to me.

            – Markus Appel
            Mar 4 at 9:10











          • I suggested an edit.

            – Markus Appel
            Mar 4 at 11:08











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "2"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f956565%2fusing-aws-fargate-as-web-server%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          10














          Your website visitors are not supposed to talk directly to the Fargate container. As you realised the IPs are not predictable and can change at any time - it’d be difficult to keep the DNS up to date.



          Instead use Application Load Balancer in front of Fargate and use the ALB’s address for your website.



          ALB will automatically register the Fargate containers as they come and go.



          Hope that helps :)






          share|improve this answer


























          • Okay, I was just testing the same, but with a Network Load Balancer. It works using the Amazon-provided domain. I also added a record to the public hosted zone that comes with the domain in Route53 (The hosted zone's name is the domain name followed by a dot) to redirect requests of type A to my load balancer. When I test the record it returns the correct IP - but in my browser the server couldn't be found. Do you know why?

            – Markus Appel
            Mar 3 at 23:06













          • @MarkusAppel Nope I don't know why. I would need more details about what's in your zone. Dare to share the actual domain name?

            – MLu
            Mar 4 at 0:33











          • I actually got it working, deleting and recreating the record set resolved the issue - almost looks like a bug to me.

            – Markus Appel
            Mar 4 at 9:10











          • I suggested an edit.

            – Markus Appel
            Mar 4 at 11:08
















          10














          Your website visitors are not supposed to talk directly to the Fargate container. As you realised the IPs are not predictable and can change at any time - it’d be difficult to keep the DNS up to date.



          Instead use Application Load Balancer in front of Fargate and use the ALB’s address for your website.



          ALB will automatically register the Fargate containers as they come and go.



          Hope that helps :)






          share|improve this answer


























          • Okay, I was just testing the same, but with a Network Load Balancer. It works using the Amazon-provided domain. I also added a record to the public hosted zone that comes with the domain in Route53 (The hosted zone's name is the domain name followed by a dot) to redirect requests of type A to my load balancer. When I test the record it returns the correct IP - but in my browser the server couldn't be found. Do you know why?

            – Markus Appel
            Mar 3 at 23:06













          • @MarkusAppel Nope I don't know why. I would need more details about what's in your zone. Dare to share the actual domain name?

            – MLu
            Mar 4 at 0:33











          • I actually got it working, deleting and recreating the record set resolved the issue - almost looks like a bug to me.

            – Markus Appel
            Mar 4 at 9:10











          • I suggested an edit.

            – Markus Appel
            Mar 4 at 11:08














          10












          10








          10







          Your website visitors are not supposed to talk directly to the Fargate container. As you realised the IPs are not predictable and can change at any time - it’d be difficult to keep the DNS up to date.



          Instead use Application Load Balancer in front of Fargate and use the ALB’s address for your website.



          ALB will automatically register the Fargate containers as they come and go.



          Hope that helps :)






          share|improve this answer















          Your website visitors are not supposed to talk directly to the Fargate container. As you realised the IPs are not predictable and can change at any time - it’d be difficult to keep the DNS up to date.



          Instead use Application Load Balancer in front of Fargate and use the ALB’s address for your website.



          ALB will automatically register the Fargate containers as they come and go.



          Hope that helps :)







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 4 at 6:59

























          answered Mar 3 at 22:53









          MLuMLu

          9,03212344




          9,03212344













          • Okay, I was just testing the same, but with a Network Load Balancer. It works using the Amazon-provided domain. I also added a record to the public hosted zone that comes with the domain in Route53 (The hosted zone's name is the domain name followed by a dot) to redirect requests of type A to my load balancer. When I test the record it returns the correct IP - but in my browser the server couldn't be found. Do you know why?

            – Markus Appel
            Mar 3 at 23:06













          • @MarkusAppel Nope I don't know why. I would need more details about what's in your zone. Dare to share the actual domain name?

            – MLu
            Mar 4 at 0:33











          • I actually got it working, deleting and recreating the record set resolved the issue - almost looks like a bug to me.

            – Markus Appel
            Mar 4 at 9:10











          • I suggested an edit.

            – Markus Appel
            Mar 4 at 11:08



















          • Okay, I was just testing the same, but with a Network Load Balancer. It works using the Amazon-provided domain. I also added a record to the public hosted zone that comes with the domain in Route53 (The hosted zone's name is the domain name followed by a dot) to redirect requests of type A to my load balancer. When I test the record it returns the correct IP - but in my browser the server couldn't be found. Do you know why?

            – Markus Appel
            Mar 3 at 23:06













          • @MarkusAppel Nope I don't know why. I would need more details about what's in your zone. Dare to share the actual domain name?

            – MLu
            Mar 4 at 0:33











          • I actually got it working, deleting and recreating the record set resolved the issue - almost looks like a bug to me.

            – Markus Appel
            Mar 4 at 9:10











          • I suggested an edit.

            – Markus Appel
            Mar 4 at 11:08

















          Okay, I was just testing the same, but with a Network Load Balancer. It works using the Amazon-provided domain. I also added a record to the public hosted zone that comes with the domain in Route53 (The hosted zone's name is the domain name followed by a dot) to redirect requests of type A to my load balancer. When I test the record it returns the correct IP - but in my browser the server couldn't be found. Do you know why?

          – Markus Appel
          Mar 3 at 23:06







          Okay, I was just testing the same, but with a Network Load Balancer. It works using the Amazon-provided domain. I also added a record to the public hosted zone that comes with the domain in Route53 (The hosted zone's name is the domain name followed by a dot) to redirect requests of type A to my load balancer. When I test the record it returns the correct IP - but in my browser the server couldn't be found. Do you know why?

          – Markus Appel
          Mar 3 at 23:06















          @MarkusAppel Nope I don't know why. I would need more details about what's in your zone. Dare to share the actual domain name?

          – MLu
          Mar 4 at 0:33





          @MarkusAppel Nope I don't know why. I would need more details about what's in your zone. Dare to share the actual domain name?

          – MLu
          Mar 4 at 0:33













          I actually got it working, deleting and recreating the record set resolved the issue - almost looks like a bug to me.

          – Markus Appel
          Mar 4 at 9:10





          I actually got it working, deleting and recreating the record set resolved the issue - almost looks like a bug to me.

          – Markus Appel
          Mar 4 at 9:10













          I suggested an edit.

          – Markus Appel
          Mar 4 at 11:08





          I suggested an edit.

          – Markus Appel
          Mar 4 at 11:08


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Server Fault!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f956565%2fusing-aws-fargate-as-web-server%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

          ComboBox Display Member on multiple fields

          Is it possible to collect Nectar points via Trainline?