Solution for local ip changes of AWS EC2 instances

后端 未结 5 1911
忘掉有多难
忘掉有多难 2021-01-30 23:01

Amazon only gives you a certain number of static ip address and the local (private) ips of each EC2 instance can change when the machine is restarted. This makes creating a stab

5条回答
  •  终归单人心
    2021-01-30 23:19

    you can change Ip Address using Elastic Ip: You Can Do Using C# Code:

     var associateRequest = new AssociateAddressRequest
                {
                     PublicIp = your Elastic Ip,
                     InstanceId = Your Instance Id Which You Assign
                };    
            amazonEc2Client.AssociateAddress(associateRequest);
    

    after That DeAssociate It.

            var disAssociateRequest = new isassociateAddressRequest(publicIp.ElasticIpAddress1);
      AmazonEc2Client.DisassociateAddress(your Elastic Ip);
    

    your Public Ip Will Change

提交回复
热议问题