Configuring an Instance with User Data and OUTSCALE Tags
You can add user data to an instance to more specifically configure it. User data can be of any type of information, like a script or text information. You can also specify tags to give precise instructions about the instance placement or IPs.
User data is data linked to the instance by the user. An instance can access user data at any time but it is taken into account only at launch. However, you can create a script contained in the OMI used to launch an instance to require that user data is taken into account at every stop and start. This enables you to modify it, and then stop and start the instance for the modifications to be applied. For more information about how to modify user data, see Modifying an Instance Attribute.
To get information about the user data of an instance, type to the following address in the terminal of the instance or in a web browser: 169.254.169.254/latest/user-data
.
Adding a Script or Text in User Data
You can add a script or any other text information in the user data of an instance. Your script can contain text variables and can be used to have the instance execute any action you need at boot, for example to automatically download a file from a bucket.
User data must be encoded in Base64, but tools such as Cockpit or AWS CLI can handle the encoding for you. The maximum size for the Base64-encoded user data is 500 kibibytes (KiB). |
These user data can be executed every time the instance boots, if the instance contains a script that can do so:
-
In the Free section of the User Data screen in the CREATE INSTANCE dialog box on Cockpit v1 or the CREATE VMs dialog box on Cockpit v2-beta (Expert Mode only), or in the
user-data
attribute of therun-instances
AWS CLI command:-
For Linux instances, you need to create a script that fetches and executes the user data. For more information, see Creating an Autonomous Instance.
-
For Windows instances, you can type your script within one of the following wrappers to execute it at boot:
Language Wrapper Description Powershell
# autoexecutepowershellnopasswd <your_script> # autoexecutepowershellnopasswd
Executes the powershell script without init password administrator. The script is launched with the administrator user.
Powershell
# autoexecutepowershell <your_script> # autoexecutepowershell
Executes the powershell script with init password administrator. The script is launched with the administrator user.
Vbscript
# autoexecutevbs <your_script> # autoexecutevbs
Executes the vbscript script with init password administrator. The script is launched with the administrator user.
If the boot script finds one of the above wrappers, it saves the script to a VB or PowerShell file in its /userdata and runs these files when the instance starts.
You can separate the commands in a script using line breaks to run all the commands you want in the Windows PowerShell command prompt.
-
Adding OUTSCALE Tags in User Data
You can add OUTSCALE tags in user data to give instructions about the placement of your instances. You can for example place instances in a same server (also called hypervisor) or cluster (a set of hypervisors) to improve network performance, or place them in different clusters to reduce risks.
You can also add these tags using the classic method. For more information, see Adding or Removing Tags. |
-
If you are using AWS CLI, create a section for all your OUTSCALE tags following this syntax:
-----BEGIN OUTSCALE SECTION----- <tags> -----END OUTSCALE SECTION-----
Insert a carriage return at the end of the code. Otherwise, the last line is not read properly.
-
Add your tags within this section following the
tags.<TAG_NAME>=<TAG_VALUE>
format.
The following tags are available:-
Tags to specify ins tructions about the placement of an instance:
Tag Name Description Tag Value Application osc.fcu.repulse_server
Places instances with the same tag value on different servers
Free
-
At instance launch
-
After a stop/start of the instance
osc.fcu.attract_server
Places instances with the same tag value on the same server
osc.fcu.repulse_cluster
Places instances with the same tag value on different Cisco UCS clusters
osc.fcu.attract_cluster
Places instances with the same tag value on the same Cisco UCS cluster
These tags can be used in
strict
mode, which means that if the requested placement options are not possible, anInsufficientCapacity
error is returned. If you do not usestrict
mode, the requested placement options are bypassed if they are not possible.To define
strict
mode, add_strict
to the tag name (for example,osc.fcu.repulse_server_strict
).In the following example, instance#1 and instance#2 are placed on the same server, if possible:
INSTANCE#1 USER DATA -----BEGIN OUTSCALE SECTION----- tags.osc.fcu.attract_server=front80 -----END OUTSCALE SECTION----- INSTANCE#2 USER DATA -----BEGIN OUTSCALE SECTION----- tags.osc.fcu.attract_server=front80 -----END OUTSCALE SECTION-----
In the following example, instance#3 and instance#4 are placed on different servers, and an error occurs if not possible:
INSTANCE#3 USER DATA -----BEGIN OUTSCALE SECTION----- tags.osc.fcu.repulse_server_strict=front80 -----END OUTSCALE SECTION----- INSTANCE#4 USER DATA -----BEGIN OUTSCALE SECTION----- tags.osc.fcu.repulse_server_strict=front80 -----END OUTSCALE SECTION-----
-
-
Tags to manage IPs associated with an instance:
Tag Name Description Tag Value Application osc.fcu.eip.auto-attach
Automatically associates an External IP (EIP) with an instance, and keeps them associated through the stop and start process
The EIP you want to associate.
For more information, see About EIPs > EIP Association.
-
At instance launch
-
After a stop/start of the instance
private_only
Blocks attribution of a public IP to an instance in the public Cloud
true
orfalse
In the following example, the 111.33.22.100 External IP is attached and fixed to the instance:
-----BEGIN OUTSCALE SECTION----- tags.osc.fcu.eip.auto-attach=111.33.22.100 -----END OUTSCALE SECTION-----
-
-
Tag to be able to use both OUTSCALE section and free section:
Tag Name Description Tag Value Application filter_private_section
Filters the OUTSCALE tags of the instance so that you can use both a section of OUTSCALE tags and a free section of user data in the same instance.
If
true
, all your OUTSCALE tags take effect, but they are not visible when reading the user data of the instance.If
false
or not defined, you cannot use both a section of OUTSCALE tags and a free section of user data.true
orfalse
-
At instance launch
-
After a stop/start of the instance
This tag is available for the OUTSCALE API only. It is not compatible with the FCU API.
-
-
Related Pages
AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.