how to create a scenario when aws is down










0















i have been working on creating EC2 instance from java SDK and I have been doing it successfully but now there is a thought that let us assume the case when AWS servers are down although I know it violates the concept of cloud still as if we want to handle this case I am not able to understand how can I create the scenario and handle this case?



public static void main(String args) {

// Set up the amazon ec2 client
AmazonEC2 ec2Client = AmazonEC2ClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(AWS_CREDENTIALS))
.withRegion(Regions.US_EAST_1)
.build();

// Launch an Amazon EC2 Instance
RunInstancesRequest runInstancesRequest = new RunInstancesRequest().withImageId("ami-777777")
.withInstanceType("t2.micro") // https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html
.withMinCount(1)
.withMaxCount(1)
.withNetworkInterfaces(new InstanceNetworkInterfaceSpecification()
.withAssociatePublicIpAddress(true)
.withDeviceIndex(0)
.withSubnetId("subnet-777777")
.withGroups("sg-777777"));

RunInstancesResult runInstancesResult = ec2Client.runInstances(runInstancesRequest);

Instance instance = runInstancesResult.getReservation().getInstances().get(0);
String instanceId = instance.getInstanceId();
System.out.println("EC2 Instance Id: " + instanceId);

// Setting up the tags for the instance
CreateTagsRequest createTagsRequest = new CreateTagsRequest()
.withResources(instance.getInstanceId())
.withTags(new Tag("Name", "codeflex-ec2"));
ec2Client.createTags(createTagsRequest);

// Starting the Instance
StartInstancesRequest startInstancesRequest = new StartInstancesRequest().withInstanceIds(instanceId);









share|improve this question




























    0















    i have been working on creating EC2 instance from java SDK and I have been doing it successfully but now there is a thought that let us assume the case when AWS servers are down although I know it violates the concept of cloud still as if we want to handle this case I am not able to understand how can I create the scenario and handle this case?



    public static void main(String args) {

    // Set up the amazon ec2 client
    AmazonEC2 ec2Client = AmazonEC2ClientBuilder.standard()
    .withCredentials(new AWSStaticCredentialsProvider(AWS_CREDENTIALS))
    .withRegion(Regions.US_EAST_1)
    .build();

    // Launch an Amazon EC2 Instance
    RunInstancesRequest runInstancesRequest = new RunInstancesRequest().withImageId("ami-777777")
    .withInstanceType("t2.micro") // https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html
    .withMinCount(1)
    .withMaxCount(1)
    .withNetworkInterfaces(new InstanceNetworkInterfaceSpecification()
    .withAssociatePublicIpAddress(true)
    .withDeviceIndex(0)
    .withSubnetId("subnet-777777")
    .withGroups("sg-777777"));

    RunInstancesResult runInstancesResult = ec2Client.runInstances(runInstancesRequest);

    Instance instance = runInstancesResult.getReservation().getInstances().get(0);
    String instanceId = instance.getInstanceId();
    System.out.println("EC2 Instance Id: " + instanceId);

    // Setting up the tags for the instance
    CreateTagsRequest createTagsRequest = new CreateTagsRequest()
    .withResources(instance.getInstanceId())
    .withTags(new Tag("Name", "codeflex-ec2"));
    ec2Client.createTags(createTagsRequest);

    // Starting the Instance
    StartInstancesRequest startInstancesRequest = new StartInstancesRequest().withInstanceIds(instanceId);









    share|improve this question


























      0












      0








      0








      i have been working on creating EC2 instance from java SDK and I have been doing it successfully but now there is a thought that let us assume the case when AWS servers are down although I know it violates the concept of cloud still as if we want to handle this case I am not able to understand how can I create the scenario and handle this case?



      public static void main(String args) {

      // Set up the amazon ec2 client
      AmazonEC2 ec2Client = AmazonEC2ClientBuilder.standard()
      .withCredentials(new AWSStaticCredentialsProvider(AWS_CREDENTIALS))
      .withRegion(Regions.US_EAST_1)
      .build();

      // Launch an Amazon EC2 Instance
      RunInstancesRequest runInstancesRequest = new RunInstancesRequest().withImageId("ami-777777")
      .withInstanceType("t2.micro") // https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html
      .withMinCount(1)
      .withMaxCount(1)
      .withNetworkInterfaces(new InstanceNetworkInterfaceSpecification()
      .withAssociatePublicIpAddress(true)
      .withDeviceIndex(0)
      .withSubnetId("subnet-777777")
      .withGroups("sg-777777"));

      RunInstancesResult runInstancesResult = ec2Client.runInstances(runInstancesRequest);

      Instance instance = runInstancesResult.getReservation().getInstances().get(0);
      String instanceId = instance.getInstanceId();
      System.out.println("EC2 Instance Id: " + instanceId);

      // Setting up the tags for the instance
      CreateTagsRequest createTagsRequest = new CreateTagsRequest()
      .withResources(instance.getInstanceId())
      .withTags(new Tag("Name", "codeflex-ec2"));
      ec2Client.createTags(createTagsRequest);

      // Starting the Instance
      StartInstancesRequest startInstancesRequest = new StartInstancesRequest().withInstanceIds(instanceId);









      share|improve this question
















      i have been working on creating EC2 instance from java SDK and I have been doing it successfully but now there is a thought that let us assume the case when AWS servers are down although I know it violates the concept of cloud still as if we want to handle this case I am not able to understand how can I create the scenario and handle this case?



      public static void main(String args) {

      // Set up the amazon ec2 client
      AmazonEC2 ec2Client = AmazonEC2ClientBuilder.standard()
      .withCredentials(new AWSStaticCredentialsProvider(AWS_CREDENTIALS))
      .withRegion(Regions.US_EAST_1)
      .build();

      // Launch an Amazon EC2 Instance
      RunInstancesRequest runInstancesRequest = new RunInstancesRequest().withImageId("ami-777777")
      .withInstanceType("t2.micro") // https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html
      .withMinCount(1)
      .withMaxCount(1)
      .withNetworkInterfaces(new InstanceNetworkInterfaceSpecification()
      .withAssociatePublicIpAddress(true)
      .withDeviceIndex(0)
      .withSubnetId("subnet-777777")
      .withGroups("sg-777777"));

      RunInstancesResult runInstancesResult = ec2Client.runInstances(runInstancesRequest);

      Instance instance = runInstancesResult.getReservation().getInstances().get(0);
      String instanceId = instance.getInstanceId();
      System.out.println("EC2 Instance Id: " + instanceId);

      // Setting up the tags for the instance
      CreateTagsRequest createTagsRequest = new CreateTagsRequest()
      .withResources(instance.getInstanceId())
      .withTags(new Tag("Name", "codeflex-ec2"));
      ec2Client.createTags(createTagsRequest);

      // Starting the Instance
      StartInstancesRequest startInstancesRequest = new StartInstancesRequest().withInstanceIds(instanceId);






      amazon-web-services amazon-ec2 aws-sdk






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 '18 at 13:51









      Sangam Belose

      1,99741824




      1,99741824










      asked Nov 14 '18 at 11:35









      Vatsal RahulVatsal Rahul

      387




      387






















          1 Answer
          1






          active

          oldest

          votes


















          1














          There is no difference in the downtime in your datacenter and in AWS datacenter. Its design level scenario where you will need to have additional server on standby to handle your traffic in another AZ or DR (Disaster recovery) site in another region.




          1. You can Stop / terminate instance in AWS region to create the downtime scenario. Please use Stop Ec2 instance to stop the instance manually.



            public StopInstancesResult stopInstances(StopInstancesRequest request) 


          2. To handle the availability of your application you need to setup application load balancer with auto-scaling group enabled. The load balancer checks for the server after every configured time (e.g. 5 second 2 min, you can choose any value) and route traffic to another instance if your current EC2 instance is unhealthy.


          3. Since all AZ are in same availability zone in same region, if your region is down then you need to have your DR site ready with all your latest code deployed. This site can be used in case of region level downtime.





          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            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%2fstackoverflow.com%2fquestions%2f53299305%2fhow-to-create-a-scenario-when-aws-is-down%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









            1














            There is no difference in the downtime in your datacenter and in AWS datacenter. Its design level scenario where you will need to have additional server on standby to handle your traffic in another AZ or DR (Disaster recovery) site in another region.




            1. You can Stop / terminate instance in AWS region to create the downtime scenario. Please use Stop Ec2 instance to stop the instance manually.



              public StopInstancesResult stopInstances(StopInstancesRequest request) 


            2. To handle the availability of your application you need to setup application load balancer with auto-scaling group enabled. The load balancer checks for the server after every configured time (e.g. 5 second 2 min, you can choose any value) and route traffic to another instance if your current EC2 instance is unhealthy.


            3. Since all AZ are in same availability zone in same region, if your region is down then you need to have your DR site ready with all your latest code deployed. This site can be used in case of region level downtime.





            share|improve this answer



























              1














              There is no difference in the downtime in your datacenter and in AWS datacenter. Its design level scenario where you will need to have additional server on standby to handle your traffic in another AZ or DR (Disaster recovery) site in another region.




              1. You can Stop / terminate instance in AWS region to create the downtime scenario. Please use Stop Ec2 instance to stop the instance manually.



                public StopInstancesResult stopInstances(StopInstancesRequest request) 


              2. To handle the availability of your application you need to setup application load balancer with auto-scaling group enabled. The load balancer checks for the server after every configured time (e.g. 5 second 2 min, you can choose any value) and route traffic to another instance if your current EC2 instance is unhealthy.


              3. Since all AZ are in same availability zone in same region, if your region is down then you need to have your DR site ready with all your latest code deployed. This site can be used in case of region level downtime.





              share|improve this answer

























                1












                1








                1







                There is no difference in the downtime in your datacenter and in AWS datacenter. Its design level scenario where you will need to have additional server on standby to handle your traffic in another AZ or DR (Disaster recovery) site in another region.




                1. You can Stop / terminate instance in AWS region to create the downtime scenario. Please use Stop Ec2 instance to stop the instance manually.



                  public StopInstancesResult stopInstances(StopInstancesRequest request) 


                2. To handle the availability of your application you need to setup application load balancer with auto-scaling group enabled. The load balancer checks for the server after every configured time (e.g. 5 second 2 min, you can choose any value) and route traffic to another instance if your current EC2 instance is unhealthy.


                3. Since all AZ are in same availability zone in same region, if your region is down then you need to have your DR site ready with all your latest code deployed. This site can be used in case of region level downtime.





                share|improve this answer













                There is no difference in the downtime in your datacenter and in AWS datacenter. Its design level scenario where you will need to have additional server on standby to handle your traffic in another AZ or DR (Disaster recovery) site in another region.




                1. You can Stop / terminate instance in AWS region to create the downtime scenario. Please use Stop Ec2 instance to stop the instance manually.



                  public StopInstancesResult stopInstances(StopInstancesRequest request) 


                2. To handle the availability of your application you need to setup application load balancer with auto-scaling group enabled. The load balancer checks for the server after every configured time (e.g. 5 second 2 min, you can choose any value) and route traffic to another instance if your current EC2 instance is unhealthy.


                3. Since all AZ are in same availability zone in same region, if your region is down then you need to have your DR site ready with all your latest code deployed. This site can be used in case of region level downtime.






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 14 '18 at 11:56









                Sangam BeloseSangam Belose

                1,99741824




                1,99741824



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • 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%2fstackoverflow.com%2fquestions%2f53299305%2fhow-to-create-a-scenario-when-aws-is-down%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

                    27

                    Top Tejano songwriter Luis Silva dead of heart attack at 64

                    Category:Rhetoric