Configuring an AMI for Longer-Life Instances

FlexNet Manager Suite 2022 R2 (On-Premises)
An AWS EC2 instance that runs for a longer period (such as at least a day or two) can take part in the normal processes for inventory collection that you use for any virtual machines, whether on-premises or in the cloud. The requirements include:
  • Installing the latest approved FlexNet inventory agent into the image
  • Adding a customized configuration file that identifies both the download location for requesting the initial policy for FlexNet inventory agent on the instance, and the upload location for inventory
  • Ensuring a unique name for each instance created from this AMI.
Both the operational schedule for FlexNet inventory agent, and the latest InventorySettings.xml providing enhanced inventory-gathering functionality, are delivered automatically as part of policy. However, this can take a couple of days in the worst case; so if you wish you may also include a start-up schedule and InventorySettings.xml in the image to shorten the time to full functionality of FlexNet inventory agent. If you do so, both of these are over-written automatically once policy is fully operational. (You can find some notes about these additional documents in Configuring an AMI for Short-Lived Instances.)

These guidelines cover both Windows and Linux instances, so skip the parts that do not apply to your platform.

To prepare an AMI for longer-life instances:

  1. In the web interface for FlexNet Manager Suite, navigate to Discovery & Inventory > Inventory Settings.
    The Inventory Settings page displays.
  2. Collect the template configuration file:
    • For a Windows-based AMI, click Download bootstrapping template file, and save mgssetup.ini to a convenient working folder (such as C:\temp). (Do not change the file name.)
    • For a Linux-based AMI, in Gathering FlexNet Inventory, copy the text from Agent third-party deployment: Sample UNIX Bootstrap Configuration File and save it as mgsft_rollout_response in a convenient working folder (such as C:\temp).
  3. From the Inventory agent drop-down list, select the version of FlexNet inventory agent you want to install in your AMI, and save it to your working folder.
    In general, install the latest available version, subject to your corporate policies. This provides access to the latest functionality. For example, to include advanced inventory for AWS EC2, you must use FlexNet inventory agent 13.2.0 or later.
  4. In your preferred flat text editor, customize your bootstrapping template file to be used for FlexNet inventory agent in your AWS EC2 environment as follows, saving the edited version in a separate subfolder.
    For Windows, the only mandatory change is to identify the download location for requesting policy, as described below. (On Windows, all other requirements are delivered through policy; but for safety we'll also provide an upload location.) On Linux, FlexNet inventory agent requires both an upload location and a download location. As always, on either platform, experts may also customize other preferences needed for your implementation, as described in the platform-specific topics in the Gathering FlexNet Inventory PDF:
    • Agent third-party deployment: Edit the Configuration File for Microsoft Windows
    • Agent third-party deployment: Configure the Bootstrap File for UNIX.
    The download (and upload) locations require a URL to the host inventory beacon. Best practice is to provide a DNS alias for your chosen inventory beacon, so that when circumstances change, a simple switch of the alias leaves any running and future instances fully operational, without requiring changes to the AMI.
    • For Windows, in mgssetup.ini:
    1. Locate this section for Common preferences, and uncomment (remove the leading semi-colon) and edit the following settings:
      ; Registry settings to be created under
      ; HKLM\Software\ManageSoft Corp\ManageSoft\Common
      desc0 = UploadSettings\Bootstrap Server\Protocol
      val0  = http
      desc1 = UploadSettings\Bootstrap Server\Priority
      val1  = 100
      desc2 = UploadSettings\Bootstrap Server\AutoPriority
      val2  = False
      desc3 = UploadSettings\Bootstrap Server\Host
      val3  =
      desc4 = UploadSettings\Bootstrap Server\Port
      val4  = 80
      desc5 = UploadSettings\Bootstrap Server\Directory
      val5  = /ManageSoftRL/
      desc6 = DownloadSettings\Bootstrap Server\Protocol
      val6  = http
      desc7 = DownloadSettings\Bootstrap Server\Priority
      val7  = 100
      desc8 = DownloadSettings\Bootstrap Server\AutoPriority
      val8  = False
      desc9 = DownloadSettings\Bootstrap Server\Host
      val9  =
      desc10 = DownloadSettings\Bootstrap Server\Port
      val10  = 80
      desc11 = DownloadSettings\Bootstrap Server\Directory
      val11  = /ManageSoftDL/
    2. Optionally, modify the Protocol values if you want to use HTTPS (val0 = https, and val6 = https).
    3. You must customize the Host preference (shown above as val3 = and val9 = to your chosen DNS alias (or preferred host setting) and your own enterprise name if the inventory beacon is located in your enterprise network rather than on an AWS EC2 instance. For an inventory beacon hosted on an AWS instance, you can identify its DNS hostname on the AWS console (select Instances in the navigation pane, choose the instance hosting the inventory beacon, and read its DNS hostname in the details pane).
      Tip: If you have an inventory beacon on an AWS instance, your installations of FlexNet inventory agent on other instances can be configured to use the private DNS hostname for accessing the inventory beacon (provided that both are within the scope of your VPC). The private hostname has greater stability, particular if the inventory beacon host is stopped and started from time to time.
    4. Optionally, customize the port settings at val4 and val10 (for example, if you are switching to the HTTPS protocol, the default port is 443).
      Important: The Directory preference is mandatory, and in each case must be set as shown above.
    5. Create a subfolder (such as LongLifeAMI) and save your edited mgssetup.ini there. Do not change the file name, which is mandatory.
    • For Linux, in mgsft_rollout_response:
    1. In the first section of the file, customize the setting for the download location (see also the comments for the upload location, next):
      # The initial download location(s) for the installation.
                                      # For example,
                                      # Refer to the documentation for further details.
    2. In the next section of the file, customize the setting for the reporting (upload) location:
      # The initial reporting location(s) for the installation.
                                  # For example,
                                  # Refer to the documentation for further details.
      You may customize the protocol to HTTPS if required, and omit or customize the port number as required. You must customize the host URL (shown above as to your chosen DNS alias (or preferred host setting) and your own enterprise name if the inventory beacon is located in your enterprise network rather than on an AWS EC2 instance. For an inventory beacon hosted on an AWS instance, you can identify its DNS hostname on the AWS console (select Instances in the navigation pane, choose the instance hosting the inventory beacon, and read its DNS hostname in the details pane).
      Important: In each case, the trailing /ManageSoftDL/ (download location) or /ManageSoftRL/ (upload or reporting location) is mandatory, and must be specified as shown above.
    3. Create a subfolder (such as LongLifeAMI) and save your edited mgsft_rollout_response there. Do not change the file name, which is mandatory.
    4. Unless you already have a strategy and practice that gives every Linux instance a unique name, also create a new text file for your Linux AMI, called tmpconfig.ini, with exactly the following two lines:
      This file is deliberately incomplete at this stage, and is to be completed at instance start-up, as described later.

    This completes the preparation of materials for your AMI for instances of this expected life. Now continue to use these materials to prepare the AMI. For both platforms, the high-level process is to customize a running instance, and then save it as an AMI.

    For a Windows-based AMI, the recommended best practice is to run Sysprep, as this can easily ensure that each instantiation from this AMI receives a unique device name. For Sysprep, AWS offers two different sets of scripts to assist, with separate documentation:
    For a Linux AMI, the following notes relate to an EBS-backed instance, since this is the simpler process, and the flexibility of the resulting instances is greater (for example, supporting stopping an instance without necessarily terminating it). If you have instead chosen to use an instance store-backed instance, follow the AWS documentation closely, and give it priority where there may be any disparities with this document. Choose from either:
  5. Following the AWS documentation, select (or create), launch and connect to your chosen instance from which you are creating your AMI.
  6. To customize your instance:
    1. Ensure that the destination folder exists for your installation of FlexNet inventory agent, and if not create it.
      The default paths for each platform are:
      • On Windows, C:\Program Files (x86)\Flexera Software\Agent
      • On Linux, /opt/managesoft/bin.
    2. From your local ShortLifeAMI working folder, copy these files as shown onto your instance:
      • For Windows, copy mgssetup.ini into the destination folder C:\Program Files (x86)\Flexera Software\Agent
      • For Linux, copy mgsft_rollout_response into /var/tmp/ on your instance.
    3. Collect the downloaded installer for FlexNet inventory agent from your working folder, and run the installer on your instance, installing FlexNet inventory agent into the prepared destination folder.
      The installer automatically configures the custom settings declared in the configuration file (either mgssetup.ini or mgsft_rollout_response, depending on platform). For more information about running the installation, see the Agent third-party deployment: Details chapter of the Gathering FlexNet Inventory PDF, focusing on the installation topic for your preferred platform.
    Tip: When creating your AMI in the following steps, make the name for this image meaningful, such as "Long-life instances", to remind you of the special conditions embodied in the AMI.
  7. Only for Windows: complete the remaining steps in the AWS document to Sysprep your instance, finishing by clicking Shutdown with Sysprep (or, for pre-2016 versions of Windows, click OK and confirm Yes to run Sysprep and shut down the instance).
    Important: If you are using EC2Launch on Windows 2016, in the Ec2 Launch Settings dialog, be sure to leave the Set Computer Name check box clear. This allows Sysprep to clear the computer name from the instance as it shuts down, so that new instances launched from this image each receive a unique device name.
  8. Only for Linux (for an EBS-backed image):
    1. Navigate to your instance configuration.
      For example, if you are creating a new instance, select the third tab across the top of your console, showing 3. Configure Instance.
    2. If necessary, scroll down, and expand the Advanced Details panel.
    3. In the User data field, add the following two lines As text to ensure that each Linux instance reports a unique device name in its inventory (lines are wrapped here for publication, but each command should be entered on a single line):
      sudo sed -i 
                                  /opt/managesoft/bin/mgsconfig -i /var/tmp/tmpconfig.ini
      The first line replaces the unfinished MachineID setting in the tmpconfig.ini file with a setting completed with the Instance ID, which is recovered in the standard way from the AWS metadata for the current image. The second line runs a small FlexNet utility that merges the new value into the standard config.ini for the Linux-based FlexNet inventory agent. These two lines of code are run as the instance is being instantiated, before the FlexNet inventory agent is run. The result is that, whenever an instance is launched from the image you are creating, FlexNet inventory agent takes the MachineID setting from the config.ini file, and reports that unique device name as part of its uploaded inventory.
    4. If your instance is running, stop it now. (Making an AMI from a stopped instance is preferred for lower risk and better stability in your image.)
  9. Monitor the Instances page in the Amazon EC2 console, until the state for your chosen instance displays stopped.
  10. Follow your preferred process to create an AMI from that stopped instance.
    For example, on Windows, since you have already installed AWS Tools for Windows PowerShell, you could use the cmdlet New-EC2Image. For Linux, in the navigation pane, you can choose Instances, select your instance, and then choose Actions > Image > Create Image, and provide the necessary details. For more information on creating AMIs, see either of:
This AMI is now ready to instantiate longer-life instances. As soon as each instance is spawned, FlexNet inventory agent asks its bootstrap inventory beacon for policy. Once downloaded, its device policy triggers delivery of your global schedule for inventory collection by the locally-installed FlexNet inventory agent, as well as the latest InventorySettings.xml file that brings enhanced functionality.

FlexNet Manager Suite (On-Premises)

2022 R2