Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 58 lines (41 sloc) 1.45 KB
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Std;
my %ami_config = (
'linux i386' => 'ami-014d8251709f6fcc4', # ortest-i386-2019-02-22 (us-west-2)
#'linux i386' => 'ami-1511a46d', # ortest-i386-2018-01-07 (us-west-2)
#'linux x86_64' => 'ami-0a7f1502cf012b78f', # ortest-x64-2019-02-05 (us-west-2)
'linux x86_64' => 'ami-0c8c75dc393ed306c', # ortest-x64-2019-02-06 (us-west-2)
);
my %opts;
getopts("ca:k:t:", \%opts) or
die "Usage: $0 [-t <instance-type>] [-k <key-pair-name>] -a <arch> <user-data>\n";
my $arch = $opts{a}
or die "No -a <arch> option specified.\n";
my $ami = $ami_config{$arch}
or die "Unknown architecture $arch.\n";
my $keypair = $opts{k} || 'ortest';
my $instance_type = $opts{t};
if (!defined $instance_type) {
if ($arch =~ /x86_64/) {
$instance_type = 'c5.large';
} else {
$instance_type = 'c3.large';
}
}
my $user_data = join (" ", @ARGV)
or die "No user data specified.\n";
my @cmd = ("aws", "ec2", "run-instances", "--image-id", $ami, "--key-name", $keypair, "--user-data", $user_data,
"--instance-type", $instance_type, #"--debug", '--availability-zone', 'us-west-1b',
'--region', 'us-west-2',
'--subnet-id', 'subnet-3438276c',
'--instance-initiated-shutdown-behavior', 'terminate',
'--output', 'text',
'--security-group-ids', 'sg-d7e8e8aa');
my $check = $opts{c};
warn "@cmd\n";
if ($check) {
exit;
}
system @cmd;
You can’t perform that action at this time.