Adding Tags to Instances (VMs)
With the Outscale Cloud, you can use property tags on different resources for effective organization. Adding tags to different resources will allow you to identify and categorize resources. For more information, see Adding or Removing Tags.
We recommend creating groups of tags to organize your resources. Companies that are the most efficient in their use of tags usually create tag groupings that enable them to organize their resources along technical, business, and security dimensions. You can also create automation-specific tags to support your automation efforts.
|Name||Tag to identify resources.|
|Environment||Tag to identify the environment, as there are usually multiple environments (production, integration, test, and so on).|
|Version||Tag to identify the version of the resources.|
|Owner||Tag to identify the person responsible for the resource.|
|Customer||Tag to identify a specific customer that a particular group of resources serves.|
|Project||Tag to identify the project the resource supports.|
|Confidentiality||Tag to identify the level of data confidentiality of the resource.|
|Compliance||Tag to identify compliance requirements.|
|Date/Time||Tag to identify the date or time a resource should be started, stopped, deleted, or rotated.|
|Security||Tag to determine security requirements, such as encryption.|
Using Metadata to Configure Your Instance (VM)
You can get information about your instances. For more information, see Accessing Metadata of an Instance.
This information is very useful when writing scripts which are executed within the instance. This works for any Outscale Linux instance, and the IP address always stays the same.
When launching an instance for the first time, you need to run scripts that initialize and install all the tools you need. These scripts will require information about your instance, and this information can be found in the metadata.
Using User Data to Get Your Tags
In order to automate configuration deployment, you can use user data to store and run scripts at every boot and get all the tags of your instance. For more information, see Creating an Autonomous Instance.
Below is an example of how you can get all the tags related to your instance:
Thanks to the tags you get in the response, you will be able to customize your deployment. Thus, you can use tags to manage your local system and your infrastructure.
Using Tags of an Instance to Apply a Specific Configuration
|Before you begin: Configure the tags when you create the instance, and get the ID of the instance.|
Get the tags of the instance:
Depending on your distribution, perform one of the following actions:
Check the installation and the returned status.
Below is an example of a simple script to automate the installation of packages with APT tags:
Customer Use Cases
In the following use cases, you can see how you can use tags in automated scripts.
Starting/Stopping an Instance (VM)
You can run automated start/stop scripts that turn off development environments during non-business hours in order to reduce costs. Using tags enables you to easily identify instances specifically used for development.
If you manage your resources well, you can plan when to start and stop your items directly in your crontab.
To get a list of specific instances, for example, instances tagged with Development, and stop them at 7 p.m.:
To start the instances in the morning, at 7 a.m.:
To finalize the automation, you need to add scripts (StopInstanceDev.sh and StartInstanceDev.sh) in Crontab. Here is an example of a simple cron job:
Deleting Old Snapshots
If you use snapshots to back up instances, you can easily forget to delete old snapshots that have become useless. In order to avoid this, you can automate the deletion of useless snapshots thanks to tagging.
To get all snapshots older than 2017-10:
To delete useless snapshots:
As a good practice, we recommend putting version tags on all your resources. You can also tag instances with Development, Integration and Production. With this type of tag, you can apply SALT recipe automatically for instances with the Development profile.
We strongly recommend adding tags to your resources, especially the most expensive ones of your account. Ultimately, tagging is the best way to follow your consumption. It will make your resources easier to navigate, and improperly configured resources easier to spot. Tagging is a critical tool in your management toolkit and the best way to keep a clear view of your Cloud resources.