Skip to content

Adjust IMDSv2 Metadata

Important

This step is not required if you are deploying Web Safety 9.2+ as it fully supports working with IMDSv2 out of the box without any additional configuration.

If you decided to deploy the PAYG version of Web Safety, you also need to switch the IMDSv2 metadata setting to Optional. This will allow the application to automatically update the PAYG license key. If this setting is configured as Required then the license extension module fails with the following error.

2024/02/02 14:17:01 Got reply status '401' ('401 Unauthorized') from 
AWS Instance Metadata Service
2024/02/02 14:17:01 Raw reply header:
2024/02/02 14:17:01 map[Connection:[close] Content-Length:[343] 
Content-Type:[text/html] Date:[Fri, 02 Feb 2024 13:17:01 GMT] Server:[EC2ws]]
2024/02/02 14:17:01 Raw reply body:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>401 - Unauthorized</title>
</head>
<body>
<h1>401 - Unauthorized</h1>
</body>
</html>
2024/02/02 14:17:01 Fatal error: invalid character '<' looking for 
beginning of value panic: Fatal error: invalid character '<' looking for 
beginning of value

Open the AWS EC2 console and navigate to Actions / Instance Settings / Modity Instance Metadata section as shown on the following screenshot.

Modify Instance Metadata

Make sure the value is set to Optional, if this is not so, set it to Optional and reboot the instance from the terminal console.

Modify Instance Metadata

After reboot check the setting again.

Modify Instance Metadata

From now on the automatic extension of PAYG license key should work correctly.