Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: PERL to AWS

by jo37 (Deacon)
on May 18, 2020 at 09:16 UTC ( [id://11116889]=note: print w/replies, xml ) Need Help??


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

$gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$

Replies are listed 'Best First'.
Re^4: PERL to AWS
by haukex (Archbishop) on May 18, 2020 at 09:25 UTC

    Sure, I wasn't saying there's something wrong with AWS::CLIWrapper (I haven't inspected it in detail), and it definitely provides some more sugar for accessing AWS that my module doesn't provide. My module just has two advantages in general: it's generic, i.e. it can be used for any command-line tools like git, docker, aws, etc., and second, a big advantage for someone like myself who thinks a lot about how to run external commands properly, I know that the module will properly handle passing any command-line arguments I throw at it, and the return values and behaviors are well-defined too.

    Maybe I'm missing the point.

    My point was: thanks for the inspiration :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11116889]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-19 09:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found