Configuring Instance Metadata Options
Scenarios
You can configure instance metadata options to control the metadata behavior of an instance.
Constraints
This function is only available in the LA-Sao Paulo1 region.
Instance Metadata Options
You can configure instance metadata options when purchasing a BMS or at its runtime.
Instance metadata can be accessed using two methods, as described in Table 1.
For security purposes, you can set the instance metadata version only to V2 (hardening). After you enforce the use of V2 (hardening), access using the V1 (traditional) method will be denied to prevent most SSRF risks.
Accessing Metadata from a BMS (Example)
You can access metadata of both Windows and Linux BMSs.
V1 (Traditional)
- Linux:
curl -X GET http://169.254.169.254/openstack/latest/meta_data.json
- Windows:
Invoke-RestMethod -Method GET -Uri http://169.254.169.254/openstack/latest/meta_data.json
V2 (Hardening)
- Linux:
# Obtain the metadata access credentials. You are advised to set X-Metadata-Token-Ttl-Seconds to 21600 (6 hours). TOKEN=`curl -X PUT http://169.254.169.254/meta-data/latest/api/token -H "X-Metadata-Token-Ttl-Seconds:21600"` # Access the instance metadata. curl -X GET http://169.254.169.254/openstack/latest/meta_data.json -H "X-Metadata-Token:$TOKEN"
- Windows:
# Obtain the metadata access credentials and set a validity period. Do not include the header X-Forwarded-For. $token = Invoke-RestMethod -Headers @{"X-Metadata-Token-Ttl-Seconds" = "21600"} -Method PUT -Uri http://169.254.169.254/meta-data/latest/api/token # Access the instance metadata. Invoke-RestMethod -Headers @{"X-Metadata-Token" = $token} -Method GET -Uri http://169.254.169.254/openstack/latest/meta_data.json
Configuring Metadata (When Purchasing a BMS)
- Log in to the BMS console and access the Buy BMS page.
Set the required parameters to purchase a BMS. For details, see Creating a Common BMS.
- In Advanced Settings, set Metadata Access to Enable.
- Set Metadata Version to Only V2 (Token).
Figure 1 Setting the metadata version
- Check the settings and click Next: Confirm. Complete the BMS creation.
Configuring Metadata (At BMS Runtime)
- Log in to the BMS console and go to the BMS list.
- In the BMS list, click the BMS name to go to its details page.
- Locate the Metadata Version row and click the edit icon.
Figure 2 Clicking the edit icon
- Select a metadata version and click OK.
Figure 3 Modifying the metadata version
After the modification is complete, the new metadata version is displayed on the BMS details page.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot