Rex::C...:Cloud(3pm)
β¨ Rex::C...:Cloud β Cloud Management Commands β¨
okay bestie, this is the Rex::C...:Cloud(3pm) page (from the User Contributed Perl Documentation, yes, in a 3pm era π
) and it's literally your all-access backstage pass to running clouds with Rex. group chat energy on, brain on, let's go π«Ά
π NAME π
Rex::Commands::Cloud β Cloud Management Commands π
βοΈ DESCRIPTION βοΈ
With this module you can manage a whole little constellation of different cloud services. Right now it's serving support for Amazon EC2, Jiffybox and OpenStack. πΈ
bestie, listen β version <= 1.0: all these functions will not be reported. so if you're on an ancient version, don't come crying to me, the functions are just not gonna show up π
π SYNOPSIS π
the vibe, in code:
use Rex::Commands::Cloud;
cloud_service "Amazon";
cloud_auth "your-access-key", "your-private-access-key";
cloud_region "ec2.eu-west-1.amazonaws.com";
task "list", sub {
print Dumper cloud_instance_list;
print Dumper cloud_volume_list;
};
task "create", sub {
my $vol_id = cloud_volume create => { size => 1, zone => "eu-west-1a", };
cloud_instance create => {
image_id => "ami-xxxxxxx",
name => "test01",
key => "my-key",
volume => $vol_id,
zone => "eu-west-1a",
};
};
task "destroy", sub {
cloud_volume detach => "vol-xxxxxxx";
cloud_volume delete => "vol-xxxxxxx";
cloud_instance terminate => "i-xxxxxxx";
};
list 'em, create 'em, destroy 'em. the full main character arc π
π EXPORTED FUNCTIONS π
π cloud_service($cloud_service)
Say which cloud service you're gonna use. Pick your fighter π₯
Services
AmazonJiffyboxOpenStack
π cloud_auth($param1, $param2, ...)
Set up the auth for your cloud service. every provider wants it differently, which is so on brand of them π
For Amazon, for example, it's this:
cloud_auth($access_key, $secret_access_key);
For JiffyBox:
cloud_auth($auth_key);
For OpenStack:
cloud_auth(
tenant_name => 'tenant',
username => 'user',
password => 'password',
);
πΊοΈ cloud_region($region)
Set the cloud region. that's it, that's the function β¨
π cloud_instance_list
Get all the instances of a cloud service. giving inventory realness π§
task "list", sub {
for my $instance (cloud_instance_list()) {
say "Arch : " . $instance->{"architecture"};
say "IP : " . $instance->{"ip"};
say "ID : " . $instance->{"id"};
say "State : " . $instance->{"state"};
}
};
There are also some parameters for this function that can change how ip addresses get gathered for some cloud providers (looking at you, OpenStack π):
task "list", sub {
my @instances = cloud_instance_list
private_network => 'private',
public_network => 'public',
public_ip_type => 'floating',
private_ip_type => 'fixed';
};
πΎ cloud_volume_list
Get all the volumes of a cloud service. your storage, your business π
task "list-volumes", sub {
for my $volume (cloud_volume_list()) {
say "ID : " . $volume->{"id"};
say "Zone : " . $volume->{"zone"};
say "State : " . $volume->{"state"};
say "Attached : " . $volume->{"attached_to"};
}
};
π cloud_network_list
Get all the networks of a cloud service. networking era π
task "network-list", sub {
for my $network (cloud_network_list()) {
say "network : " . $network->{network};
say "name : " . $network->{name};
say "id : " . $network->{id};
}
};
πΌοΈ cloud_image_list
Get a list of all the available cloud images. window shopping, but for operating systems π₯
π cloud_upload_key
Upload a public SSH key to your cloud provider. so polite of you π
private_key '~/.ssh/mykey
public_key '~/.ssh/mykey.pub';
task "cloudprovider", sub {
cloud_upload_key;
cloud_instance create => {
...
};
};
π― get_cloud_instances_as_group
Get a list of all running instances of a cloud service. perfect for a group definition, which is honestly so convenient β¨
group fe => "fe01", "fe02", "fe03";
group ec2 => get_cloud_instances_as_group();
π₯οΈ cloud_instance($action, $data)
This one function controls, like, every aspect of a cloud instance. the multitasker of the group π«Ά
create β Create a new instance.
cloud_instance create => {
image_id => "ami-xxxxxx",
key => "ssh-key",
name => "fe-ec2-01", # name is not necessary
volume => "vol-yyyyy", # volume is not necessary
zone => "eu-west-1a", # zone is not necessary
floating_ip => "89.39.38.160" # floating_ip is not necessary
};
start β Start an existing instance.
cloud_instance start => "instance-id";
stop β Stop an existing instance.
cloud_instance stop => "instance-id";
terminate β Terminate an instance. β οΈ this will destroy all data and remove the instance. no takebacks, bestie, this is permanent π
cloud_instance terminate => "i-zzzzzzz";
π get_cloud_regions
Returns all regions as an array. the whole map, in a list π
π½ cloud_volume($action , $data)
This function controls, like, every aspect of a cloud volume. same energy, different resource πΎ
create β Create a new volume. Size is in Gigabytes, okay, so 1 means 1GB, not one byte π
task "create-vol", sub {
my $vol_id = cloud_volume create => { size => 1, zone => "eu-west-1a", };
};
attach β Attach a volume to an instance. it's giving commitment π«Ά
task "attach-vol", sub {
cloud_volume attach => "vol-xxxxxx", to => "server-id";
};
detach β Detach a volume from an instance. we love a clean breakup π
task "detach-vol", sub {
cloud_volume detach => "vol-xxxxxx", from => "server-id";
};
delete β Delete a volume. β οΈ this will destroy all data. seriously. gone. π
task "delete-vol", sub {
cloud_volume delete => "vol-xxxxxx";
};
π get_cloud_floating_ip
Returns the first available floating IP. grab it while it's hot π₯
task "get_floating_ip", sub {
my $ip = get_cloud_floating_ip;
my $instance = cloud_instance create => {
image_id => 'edffd57d-82bf-4ffe-b9e8-af22563741bf',
name => 'instance1',
plan_id => 17,
floating_ip => $ip
};
};
πΈοΈ cloud_network
the network function, home of its two little action besties π
create β Create a new network.
task "create-net", sub {
my $net_id = cloud_network create => { cidr => '192.168.0.0/24', name => "mynetwork", };
};
delete β Delete a network.
task "delete-net", sub {
cloud_network delete => '18a4ccf8-f14a-a10d-1af4-4ac7fee08a81';
};
ποΈ get_cloud_availability_zones
Returns all availability zones of a cloud service β if available. keyword: if π
task "get-zones", sub {
print Dumper get_cloud_availability_zones;
};
π¦ get_cloud_plans
Retrieve information about the available cloud plans. If supported. β
π§ get_cloud_operating_systems
Retrieve information about the available cloud plans. If supported. (yes, bestie, it says exactly the same thing as the one above β I'm not editing the lore, I'm just reading it to you π)
πͺ cloud_object
Returns the cloud object itself. the final boss. the source material. the mirror π¦
and that's the whole page, bestie π this was Rex::C...:Cloud(3pm) from the User Contributed Perl Documentation, perl v5.40.1, dated 2025-10-03 β so yes, freshly timestamped and everything. go manage some clouds, you absolute icon πβ¨π
π¦ where this page comes from
- ubuntu resolute: rex 1.16.1-1 Β· Apache-2.0
- ubuntu stonking: rex 1.16.1-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms