Is a static IP necessary for a domain, in Amazon Lightsail?

0

Hi dear community,

I am still very much at the beginning. Only recently I came across Amazon AWS. The reason was: My sites worked with my hoster partly very good and partly very bad. Therefore, I once switched to a gescheiden :- ). Now I just move my website www.darm-fit.at. I just created a server in Amazon Lightsail for this purpose. On this server I set up a static IP: http://3.72.145.190/ and just now I connected the website to one of my unused domains: www.sebastian-naschberger.at. The performance is really outstanding. Now my two questions are:

  • Should I leave the static IP address online?
  • How to create a redirect from the static IP address to the domain?

Lg and I am grateful for any answer Sebastian

profile picture
asked 7 months ago218 views
2 Answers
1
Accepted Answer

Should I leave the static IP address online?

If you have registered this the static IP to your domain, and you want to keep your website accessible via the domain, then yes. If you don't want to serve your website anymore, you can release it.

How to create a redirect from the static IP address to the domain?

There is no way to redirect a static IP to its domain(s). If you send request to a static IP, the request will be sent directly to its origin. If you send request to a domain, your HTTP client first sends DNS queries to the name servers, receives a resolved IP address, then send request to the origin.

profile picture
HS
answered 7 months ago
profile picture
EXPERT
reviewed a month ago
  • Thank you very much for the answer. Then I have a last question for a beginner. Does every website like www.apple.com have a static ip? And with the static ip the website can be visited?

    nice regards sebastian

  • Yes, every website has a static IP as long as it is publicly accessible. For www.apple.com, you can use nslookup command to resolve its IP, which is 23.210.40.201.

    $ nslookup www.apple.com
    Server:         127.0.0.11
    Address:        127.0.0.11#53
    
    Non-authoritative answer:
    www.apple.com   canonical name = www.apple.com.edgekey.net.
    www.apple.com.edgekey.net       canonical name = www.apple.com.edgekey.net.globalredir.akadns.net.
    www.apple.com.edgekey.net.globalredir.akadns.net        canonical name = e6858.dscx.akamaiedge.net.
    Name:   e6858.dscx.akamaiedge.net
    Address: 23.210.40.201
    Name:   e6858.dscx.akamaiedge.net
    Address: 2600:140b:1a00:3ae::1aca
    Name:   e6858.dscx.akamaiedge.net
    Address: 2600:140b:1a00:38e::1aca

    Then, you can access the website by its static IP with your HTTP client (e.g., curl command).

    $ curl -sSL -H "Host: www.apple.com" 23.210.40.201 | sed '/^\s*$/d'
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" prefix="og: http://ogp.me/ns#" class="no-js" data-layout-name="avail-bts-2023-ribbon-takedown">
    <head>
    <meta charset="utf-8" />
    <link rel="canonical" href="https://www.apple.com/" />
            <link rel="alternate" href="https://www.apple.com/" hreflang="en-US" /><link rel="alternate" href="https://www.apple.com/ae-ar/" hreflang="ar-AE" /><link rel="alternate" href="https://www.apple.com/ae/" hreflang="en-AE" /><link rel="alternate" href="https://www.apple.com/am/" hreflang=
  • Thanks for the detailed answer. Now I understand it even better :- D.

0

As per HS, leave the static IP attached.

For question 2, you can use Apache server rules to redirect. I do not remember exact syntax, but I think it is roughly as below

<VirtualHost *:80>
  RewriteEngine on
  RewriteCond %{SERVER_NAME} = 3.72.145.190
  RewriteRule ^ https://www.darm-fit.at
 </VirtualHost>

Do test and backup your config.

AWS
EXPERT
Mike_L
answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions