in reply to Re^2: PERL to AWS
in thread PERL to AWS
Taking a real life example, I don't see an advantage in using IPC::Run3::Shell::CLIWrapper over AWS::CLIWrapper:
#!/usr/bin/perl use strict; use warnings; use AWS::CLIWrapper; use Data::Dumper; my $aws = AWS::CLIWrapper->new(profile => 'my_profile') or die $AWS::CLIWrapper::Error->{Message}; sub gethosts { my $name = shift; my $hosts = $aws->ec2('describe-instances' => { filters => [{Name => 'tag:Name', Values => [$name]}], query => 'Reservations[*].Instances[*].{Id:InstanceId,Addr:Pri +vateIpAddress,Zone:Placement.AvailabilityZone,Name:(Tags[?Key==`Name` +])[0].Value}'}) or die "$AWS::CLIWrapper::Error->{Message}"; return [map {@$_} @$hosts]; } my $hosts = gethosts('*something*'); print Dumper($hosts);
Doesn't this feel very "perlish"? :-)
Maybe I'm missing the point.
Greetings,
-jo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: PERL to AWS
by haukex (Archbishop) on May 18, 2020 at 09:25 UTC |