Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: DOC-620


Panel
bgColor#F6F5F5
borderWidth0

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 IP addresses.   

User data are data linked to the instance by the user. An instance can access user data at any time but they are 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 are taken into account at every stop and start. This enables you to modify them, 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 .

Include Page
INCL:_RC-ToC-Task-Choice
INCL:_RC-ToC-Task-Choice

Table of Contents
maxLevel1



Panel
borderColor#FFFFFF
bgColor#F6F5F5
borderWidth2
titleBGColor#E6E6E6
borderStylesolid
titleRelated Pages


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.

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
    Status
    colourBlue
    titleCreate Instance
      dialog box (Expert Mode only) on Cockpit, or in the
    user-data attribute of the run-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:

      LanguageWrapperDescription
      Powershell


      Code Block
      languagetext
      # autoexecutepowershellnopasswd
      <your_script>
      # autoexecutepowershellnopasswd 


      Executes the powershell script without init password administrator. The script is launched with the administrator user.
      Powershell


      Code Block
      languagetext
      # autoexecutepowershell
      <your_script>
      # autoexecutepowershell


      Executes the powershell script with init password administrator. The script is launched with the administrator user.
      Vbscript


      Code Block
      languagetext
      # 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.

      Tip

      You can separate the commands in a script using line breaks to run all the commands you want in the Windows PowerShell command prompt.





Anchor
Tags to manage IP
Tags to manage IP
Adding OUTSCALE Tags 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.  

Info
You can also add these tags using the classic method. For more information, see Adding or Removing Tags.


  1. If you are using AWS CLI, create a section for all your OUTSCALE tags following this syntax:

    Code Block
    languagetext
    -----BEGIN OUTSCALE SECTION-----
    <tags>
    -----END OUTSCALE SECTION-----


    - Do not add a blank space at the end of each line.
    -
    Warning
    Note
    Insert a carriage return at the end of the code. Otherwise, the last line is not read properly. 
    Info
    If you are using Cockpit, this section is already created.


  2. Add your tags within this section following the tags.TAG<TAG_NAMENAME>=TAG<TAG_VALUEVALUE> format.
    The following tags are available:

    • Tags to specify ins tructions about the placement of an instance: 

      Include Page
      INCL:_RC-FCU-Table-UserDataPlacement
      INCL:_RC-FCU-Table-UserDataPlacement

      In the following example, instance#1 and instance#2 are placed on the same server, if possible:

      Code Block
      languagetext
      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:

      Code Block
      languagetext
      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 IP addresses associated with an instance:

      Include Page
      INCL:_RC-FCU-Table-UserDataIps
      INCL:_RC-FCU-Table-UserDataIps

      In the following example, the 111.33.22.100 External IP address is attached and fixed to the instance:

      If the instance is already started, you need to add the following as EC2 tag, before stopping and restarting the instance (no reboot):

      osc.fcu.eip.auto-attach:111.33.22.100
      Code Block
      languagetext
      -----BEGIN OUTSCALE SECTION-----
      tags.osc.fcu.eip.auto-attach=111.33.22.100
      -----END OUTSCALE SECTION-----
       
      Note



    • Tag to be able to use both OUTSCALE section and free section:
      Include Page
      INCL:_RC-FCU-Table-UserDataFilterPrivateSection
      INCL:_RC-FCU-Table-UserDataFilterPrivateSection



Include Page
INCL:_RC-General-Panel-LegalMentions
INCL:_RC-General-Panel-LegalMentions