| Table of Contents |
|---|
Introduction
| Tip |
|---|
We will exemplify by deploying to the EWC site running on EUMETSAT's infrastructure. However, note steps described in this guide are valid for deployment on the ECMWF site as well. |
You can deploy Items from the EWC Community Hub to provision cloud resources such as compute instances, networking, and storage. This guide shows just one of many use-cases. We will deploy an Item of Technology Terraform Module, to 1) create an Ubuntu 24.04 instance with GPU, 2) safely modify its attachments (public IP address, additional disks), 3) clean everything up afterwards.
Prerequisites
OpenStack Application Credentials: To authorize the creation of the compute instance itself:
- Request your credentials (if none available).
SSH access: In this example, by impersonating the default Linux account of EWC's Ubuntu VM images via a valid keypair:
- Create a keypair (if none available).
- Import SSH keys (public) (into OpenStack for automatic distribution upon VM creation).
EWC Documentation: reference for
image_nameandflavor_namesupported on your deployment site:Work environment equipped with:
- Git ≥ 2.0
- Terraform ≥ 1.5
- Python ≥ 3.9 (required by the OpenStack provider).
...
If any of the above raises an error, or the version is older than recommended, install/update via your package manager of preference. You can also follow thee official Terraform documentation for OS-specific installation steps.
Step-by-Step Deployment
1. Download the Item
Find the Item's detail page on the EWC Community Hub Dashboard, namely the OpenStack Compute Instance Item. On the Item details page, pay attention to the following:
...
| Code Block | ||
|---|---|---|
| ||
$ git checkout 1.4.0 |
2. Setup Authentication
Terraform must authenticate against EWC's OpenStack API. If you lack credentials, follow these steps to request them.
With your credentials file at hand, export its content as environmental variables within your workspace, in the same way you would if you were using the OpenStack CLI.
3. Customize Your Target Host
| Info |
|---|
Refer to the list of available virtual images, default Linux user accounts per image, and offered hardware plans. |
...
| Code Block |
|---|
# main.tf
locals {
keypair_name = "john-cloudy-publickey" # <- REPLACE WITH CORRECT KEYPAIR NAME
virtual_image = "Ubuntu 22.04 NVIDIA_AI"
plan = "vm.a6000.4"
app_name = "demo" # <- REPLACE WITH PREFERABLE NAME
instance_name = "john-cloudy" # <- REPLACE WITH PREFERABLE NAME
instance_index = 1 # <- REPLACE WITH PREFERABLE INDEX
private_networks = ["private"]
external_network = "external"
security_groups = ["ssh"]
instance_has_fip = true
extra_volume = true
extra_volume_size = 512
extra_volume2 = true
extra_volume2_size = 512
tags = {
environment = "production" # <- REPLACE WITH PREFERABLE ENV INFO
owner = "john-cloudy" # <- REPLACE WITH PREFERABLE OWNER INFO
deployment-tool = "terraform"
}
}
terraform {
required_version = ">= 0.14.0"
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
version = "~> 1.53.0"
}
}
}
data "openstack_images_image_v2" "image" {
name = local.virtual_image
most_recent = true
}
data "openstack_compute_flavor_v2" "flavor" {
name = local.plan
}
module "instance" {
source = "./ewc-tf-module-openstack-compute"
app_name = local.app_name
instance_name = local.instance_name
instance_index = local.instance_index
image_id = data.openstack_images_image_v2.image.id
flavor_id = data.openstack_compute_flavor_v2.flavor.id
keypair_name = local.keypair_name
networks = local.private_networks
instance_has_fip = local.instance_has_fip
extra_volume = local.extra_volume
extra_volume_size = local.extra_volume_size
extra_volume2 = local.extra_volume2
extra_volume2_size = local.extra_volume2_size
security_groups = local.security_groups
external_network_name = local.external_network
tags = local.tags
} |
4. Apply the Terraform Changes
Initialize and apply:
| Code Block |
|---|
$ terraform init |
...
| Code Block |
|---|
$ ssh -T ubuntu@188.115.7.131 -i ~/.ssh/id_rsa |
4.1. (Optional) Update Customization & Re-run
| Note |
|---|
Depending on the type of change you configure, resources could be updated in place, or destroyed an recreated. To avoid unexpected downtime or data loss, always review the changes planned by Terraform before approving them. |
...
| Code Block |
|---|
... module.instance.openstack_networking_floatingip_v2.fip[0]: Destruction complete after 8s module.instance.openstack_blockstorage_volume_v3.instance_volume2[0]: Still destroying... [id=1201e3b3-0134-43a1-8ccc-85692ab76038, 00m10s elapsed] module.instance.openstack_blockstorage_volume_v3.instance_volume2[0]: Destruction complete after 10s Apply complete! Resources: 0 added, 0 changed, 4 destroyed. |
4.2. (Optional) Cleaning Up
Optional but recommended; cleaning up any unused infrastructure its a chore, sometimes time-consuming, but important nontheless.
...
You will be prompted for confirmation. Make sure the resources listed for destruction are indeed related to your VM. Confirm to accept changes by typing yes.
Conclusion
All done! You now equipped to provision and teardown cloud infrastructure with a full-managed state, using nothing but the Community Hub and a couple of commands~🎉
Best Practices
- Use security groups to restrict traffic (e.g., only SSH or HTTPS).
- Pin provider versions in
main.tffor reproducibility. - Use
terraform planbefore every apply. - Always add informative tags (
tags = {…}) for easier costs traceability and administration. - Consider versioning/backing up the
main.tfyou created, as well as theterraform.tfstatefile that resulted from the execution, using for example git. This helps to avoid loosing track of your the resources' state.
Troubleshooting
Checkout the troubleshooting documentation of the Item for information on common problems and how to troubleshoot them. For unresolved issues, check the GitHub issues for a similar problem, ask the community on the peer support channel of the EWC discussion platform. You may also place a tickets at EWC Support Portal when dealing with EWC open-sourced Items.