2016-10-02 73 views
1

我正在運行一個將文件寫入Amazon S3的rails應用程序。現在,我已將uniqorn作爲服務器運行,並查看來自不同亞馬遜AWS IP地址的所有大量請求。EC2中Rails應用程序記錄的頻繁意外請求 - 來自Amazon公共IP地址 - 爲什麼?

這裏是我的日誌文件的一部分:

Started GET "/" for 54.245.168.11 at 2016-10-02 18:30:50 +0000 

Processing by StaticPagesController#home as */* 

    Rendered static_pages/home.html.erb within layouts/application (0.2ms) 

    Rendered layouts/_shim.html.erb (0.1ms) 

    Rendered layouts/_header.html.erb (0.3ms) 

Completed 200 OK in 3ms (Views: 3.0ms | ActiveRecord: 0.0ms) 

Started GET "/" for 54.252.254.235 at 2016-10-02 18:30:51 +0000 

Processing by StaticPagesController#home as */* 

    Rendered static_pages/home.html.erb within layouts/application (0.2ms) 

    Rendered layouts/_shim.html.erb (0.0ms) 

    Rendered layouts/_header.html.erb (0.3ms) 

Completed 200 OK in 3ms (Views: 3.0ms | ActiveRecord: 0.0ms) 

Started GET "/" for 54.232.40.107 at 2016-10-02 18:30:52 +0000 

Processing by StaticPagesController#home as */* 

    Rendered static_pages/home.html.erb within layouts/application (0.7ms) 

    Rendered layouts/_shim.html.erb (0.2ms) 

    Rendered layouts/_header.html.erb (1.8ms) 

Completed 200 OK in 12ms (Views: 10.6ms | ActiveRecord: 0.0ms) 

Started GET "/" for 54.252.79.139 at 2016-10-02 18:30:52 +0000 

Processing by StaticPagesController#home as */* 

    Rendered static_pages/home.html.erb within layouts/application (0.7ms) 

    Rendered layouts/_shim.html.erb (0.3ms) 

    Rendered layouts/_header.html.erb (1.5ms) 

Completed 200 OK in 13ms (Views: 11.6ms | ActiveRecord: 0.0ms) 

Started GET "/" for 54.250.253.203 at 2016-10-02 18:30:52 +0000 

Processing by StaticPagesController#home as */* 

    Rendered static_pages/home.html.erb within layouts/application (0.5ms) 

    Rendered layouts/_shim.html.erb (0.1ms) 

    Rendered layouts/_header.html.erb (0.3ms) 

Completed 200 OK in 4ms (Views: 3.2ms | ActiveRecord: 0.0ms) 

Started GET "/" for 54.243.31.203 at 2016-10-02 18:30:54 +0000 

Processing by StaticPagesController#home as */* 

    Rendered static_pages/home.html.erb within layouts/application (0.5ms) 

    Rendered layouts/_shim.html.erb (0.0ms) 

    Rendered layouts/_header.html.erb (0.3ms) 

Completed 200 OK in 4ms (Views: 3.5ms | ActiveRecord: 0.0ms) 

我無法找到這個網上的任何信息。我的應用程序還沒有生效,所以沒人看。 AWS爲什麼要這樣做?

回答

1

這些是Route 53 Health Checks,它們是與Elastic Load Balancer(ELB)中配置的運行狀況檢查不同類型的運行狀況檢查,與EC2在每個EC2實例上自動執行的EC2實例運行狀況和可訪問性檢查不同。

看看發佈的AWS IP Address Ranges,你會發現它們與專門分配給Route 53健康狀況檢查的地址塊非常吻合。

例如,這個請求......

Started GET "/" for 54.232.40.107 at 2016-10-02 18:30:52 +0000 

...匹配此條目...

{ 
    "ip_prefix": "54.232.40.64/26", 
    "region": "sa-east-1", 
    "service": "ROUTE53_HEALTHCHECKS" 
}, 

...因爲54.232.40.64/26CIDR規格從IP地址塊54.232.40.64至54.232.40.127。

如果您對堆棧配置了Route 53運行狀況檢查,那麼您現在可能已經有了答案。

路由53健康檢查通常用於驅動複雜DNS配置的邏輯,例如在有多個候選服務器在地理上分佈的情況下,並且您希望根據服務器的運行狀況控制由DNS返回的答案...但它們也可以用於監視延遲和應用程序性能(測量TCP連接時間和第一個字節的時間以及可用性),綁定到CloudWatch警報中,並用於驅動擴展和其他邏輯。如果你配置這樣的東西,這個問題可能會解決。

但是,如果您沒有這樣做,這可能是另一個AWS用戶根據他們以前使用的IP地址配置了運行狀況檢查的情況,或者是由於簡單的錯誤而針對您的IP地址或主機名配置了檢查。

如果是這樣,您需要檢查傳入請求中的請求頭。你會發現這樣的事情:

User-Agent: Amazon Route 53 Health Check Service; ref:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx; report http://amzn.to/zzzzzzz 

有了這些值,與其他報頭和任何相關的日誌條目一起,你可以訪問你拍攝的頭部中提供了「報告」的網址,(它類似於到我上面顯示的那個,從我的日誌中捕獲,但由於它似乎是通用的,所以已經過清理,但我不確定 - 我的日誌中的鏈接將我重定向到here),並提交AWS與您一起工作的請求以消除不必要的健康檢查。

但首先,試試這個......

取值後,立即「裁判:」並從它創建一個URL,利用這個模板:

https://console.aws.amazon.com/route53/healthchecks/home#/details/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

(與您參考:,不包括實際的字符串替換ref: XXXX)。

如果運行狀況檢查來自您自己的AWS賬戶,並且您已登錄到控制檯並且有權查看它,那麼此鏈接應該使健康狀況檢查適合您查看。如果您遇到「未被授權訪問此資源」的錯誤,則健康檢查不是來自您的AWS賬戶,或者您不是AWS賬戶中的特權用戶,因此可能無法查看它。