NAME
AWS::CLIWrapper - Wrapper module for aws-cli
SYNOPSIS
use AWS::CLIWrapper;
my $aws = AWS::CLIWrapper->new(
region => 'us-west-1',
);
my $res = $aws->ec2(
'describe-instances' => {
instance_ids => ['i-XXXXX', 'i-YYYYY'],
},
timeout => 18, # optional. default is 30 seconds
);
if ($res) {
for my $rs ( @{ $res->{Reservations} }) {
for my $is (@{ $rs->{Instances} }) {
print $is->{InstanceId},"\n";
}
}
} else {
warn $AWS::CLIWrapper::Error->{Code};
warn $AWS::CLIWrapper::Error->{Message};
}
DESCRIPTION
AWS::CLIWrapper is wrapper module for aws-cli (recommend: awscli >= 1.0.0, requires: >= 0.40.0).
AWS::CLIWrapper is a just wrapper module, so you can do everything what you can do with aws-cli.
See note below about making sure AWS credentials are accessible (especially under crond)
METHODS
- new($param:HashRef)
-
Constructor of AWS::CLIWrapper. Acceptable AWS CLI params are:
region region_name:Str profile profile_name:Str endpoint_url endpoint_url:Str
Additionally, the these params can be used to control the wrapper behavior:
nofork Truthy to avoid forking when executing `aws` timeout `aws` execution timeout croak_on_error Truthy to croak() with the error message when `aws` exits with non-zero code catch_error_pattern Regexp pattern to match for error handling. catch_error_retries Retries for handling errors. catch_error_min_delay Minimal delay before retrying `aws` call when an error was caught. catch_error_max_delay Maximal delay before retrying `aws` call.
See below for more detailed explanation.
- accessanalyzer($operation:Str, $param:HashRef, %opt:Hash)
- account($operation:Str, $param:HashRef, %opt:Hash)
- acm($operation:Str, $param:HashRef, %opt:Hash)
- acm_pca($operation:Str, $param:HashRef, %opt:Hash)
- alexaforbusiness($operation:Str, $param:HashRef, %opt:Hash)
- amp($operation:Str, $param:HashRef, %opt:Hash)
- amplify($operation:Str, $param:HashRef, %opt:Hash)
- amplifybackend($operation:Str, $param:HashRef, %opt:Hash)
- amplifyuibuilder($operation:Str, $param:HashRef, %opt:Hash)
- apigateway($operation:Str, $param:HashRef, %opt:Hash)
- apigatewaymanagementapi($operation:Str, $param:HashRef, %opt:Hash)
- apigatewayv2($operation:Str, $param:HashRef, %opt:Hash)
- appconfig($operation:Str, $param:HashRef, %opt:Hash)
- appconfigdata($operation:Str, $param:HashRef, %opt:Hash)
- appfabric($operation:Str, $param:HashRef, %opt:Hash)
- appflow($operation:Str, $param:HashRef, %opt:Hash)
- appintegrations($operation:Str, $param:HashRef, %opt:Hash)
- application_autoscaling($operation:Str, $param:HashRef, %opt:Hash)
- application_insights($operation:Str, $param:HashRef, %opt:Hash)
- applicationcostprofiler($operation:Str, $param:HashRef, %opt:Hash)
- appmesh($operation:Str, $param:HashRef, %opt:Hash)
- apprunner($operation:Str, $param:HashRef, %opt:Hash)
- appstream($operation:Str, $param:HashRef, %opt:Hash)
- appsync($operation:Str, $param:HashRef, %opt:Hash)
- arc_zonal_shift($operation:Str, $param:HashRef, %opt:Hash)
- athena($operation:Str, $param:HashRef, %opt:Hash)
- auditmanager($operation:Str, $param:HashRef, %opt:Hash)
- autoscaling($operation:Str, $param:HashRef, %opt:Hash)
- autoscaling_plans($operation:Str, $param:HashRef, %opt:Hash)
- backup($operation:Str, $param:HashRef, %opt:Hash)
- backup_gateway($operation:Str, $param:HashRef, %opt:Hash)
- backupstorage($operation:Str, $param:HashRef, %opt:Hash)
- batch($operation:Str, $param:HashRef, %opt:Hash)
- billingconductor($operation:Str, $param:HashRef, %opt:Hash)
- braket($operation:Str, $param:HashRef, %opt:Hash)
- budgets($operation:Str, $param:HashRef, %opt:Hash)
- ce($operation:Str, $param:HashRef, %opt:Hash)
- chime($operation:Str, $param:HashRef, %opt:Hash)
- chime_sdk_identity($operation:Str, $param:HashRef, %opt:Hash)
- chime_sdk_media_pipelines($operation:Str, $param:HashRef, %opt:Hash)
- chime_sdk_meetings($operation:Str, $param:HashRef, %opt:Hash)
- chime_sdk_messaging($operation:Str, $param:HashRef, %opt:Hash)
- chime_sdk_voice($operation:Str, $param:HashRef, %opt:Hash)
- cleanrooms($operation:Str, $param:HashRef, %opt:Hash)
- cloud9($operation:Str, $param:HashRef, %opt:Hash)
- cloudcontrol($operation:Str, $param:HashRef, %opt:Hash)
- clouddirectory($operation:Str, $param:HashRef, %opt:Hash)
- cloudformation($operation:Str, $param:HashRef, %opt:Hash)
- cloudfront($operation:Str, $param:HashRef, %opt:Hash)
- cloudhsm($operation:Str, $param:HashRef, %opt:Hash)
- cloudhsmv2($operation:Str, $param:HashRef, %opt:Hash)
- cloudsearch($operation:Str, $param:HashRef, %opt:Hash)
- cloudsearchdomain($operation:Str, $param:HashRef, %opt:Hash)
- cloudtrail($operation:Str, $param:HashRef, %opt:Hash)
- cloudtrail_data($operation:Str, $param:HashRef, %opt:Hash)
- cloudwatch($operation:Str, $param:HashRef, %opt:Hash)
- codeartifact($operation:Str, $param:HashRef, %opt:Hash)
- codebuild($operation:Str, $param:HashRef, %opt:Hash)
- codecatalyst($operation:Str, $param:HashRef, %opt:Hash)
- codecommit($operation:Str, $param:HashRef, %opt:Hash)
- codeguru_reviewer($operation:Str, $param:HashRef, %opt:Hash)
- codeguru_security($operation:Str, $param:HashRef, %opt:Hash)
- codeguruprofiler($operation:Str, $param:HashRef, %opt:Hash)
- codepipeline($operation:Str, $param:HashRef, %opt:Hash)
- codestar($operation:Str, $param:HashRef, %opt:Hash)
- codestar_connections($operation:Str, $param:HashRef, %opt:Hash)
- codestar_notifications($operation:Str, $param:HashRef, %opt:Hash)
- cognito_identity($operation:Str, $param:HashRef, %opt:Hash)
- cognito_idp($operation:Str, $param:HashRef, %opt:Hash)
- cognito_sync($operation:Str, $param:HashRef, %opt:Hash)
- comprehend($operation:Str, $param:HashRef, %opt:Hash)
- comprehendmedical($operation:Str, $param:HashRef, %opt:Hash)
- compute_optimizer($operation:Str, $param:HashRef, %opt:Hash)
- configservice($operation:Str, $param:HashRef, %opt:Hash)
- configure($operation:Str, $param:HashRef, %opt:Hash)
- connect($operation:Str, $param:HashRef, %opt:Hash)
- connect_contact_lens($operation:Str, $param:HashRef, %opt:Hash)
- connectcampaigns($operation:Str, $param:HashRef, %opt:Hash)
- connectcases($operation:Str, $param:HashRef, %opt:Hash)
- connectparticipant($operation:Str, $param:HashRef, %opt:Hash)
- controltower($operation:Str, $param:HashRef, %opt:Hash)
- cur($operation:Str, $param:HashRef, %opt:Hash)
- customer_profiles($operation:Str, $param:HashRef, %opt:Hash)
- databrew($operation:Str, $param:HashRef, %opt:Hash)
- dataexchange($operation:Str, $param:HashRef, %opt:Hash)
- datapipeline($operation:Str, $param:HashRef, %opt:Hash)
- datasync($operation:Str, $param:HashRef, %opt:Hash)
- dax($operation:Str, $param:HashRef, %opt:Hash)
- deploy($operation:Str, $param:HashRef, %opt:Hash)
- detective($operation:Str, $param:HashRef, %opt:Hash)
- devicefarm($operation:Str, $param:HashRef, %opt:Hash)
- devops_guru($operation:Str, $param:HashRef, %opt:Hash)
- directconnect($operation:Str, $param:HashRef, %opt:Hash)
- discovery($operation:Str, $param:HashRef, %opt:Hash)
- dlm($operation:Str, $param:HashRef, %opt:Hash)
- dms($operation:Str, $param:HashRef, %opt:Hash)
- docdb($operation:Str, $param:HashRef, %opt:Hash)
- docdb_elastic($operation:Str, $param:HashRef, %opt:Hash)
- drs($operation:Str, $param:HashRef, %opt:Hash)
- ds($operation:Str, $param:HashRef, %opt:Hash)
- dynamodb($operation:Str, $param:HashRef, %opt:Hash)
- dynamodbstreams($operation:Str, $param:HashRef, %opt:Hash)
- ebs($operation:Str, $param:HashRef, %opt:Hash)
- ec2($operation:Str, $param:HashRef, %opt:Hash)
- ec2_instance_connect($operation:Str, $param:HashRef, %opt:Hash)
- ecr($operation:Str, $param:HashRef, %opt:Hash)
- ecr_public($operation:Str, $param:HashRef, %opt:Hash)
- ecs($operation:Str, $param:HashRef, %opt:Hash)
- efs($operation:Str, $param:HashRef, %opt:Hash)
- eks($operation:Str, $param:HashRef, %opt:Hash)
- elastic_inference($operation:Str, $param:HashRef, %opt:Hash)
- elasticache($operation:Str, $param:HashRef, %opt:Hash)
- elasticbeanstalk($operation:Str, $param:HashRef, %opt:Hash)
- elastictranscoder($operation:Str, $param:HashRef, %opt:Hash)
- elb($operation:Str, $param:HashRef, %opt:Hash)
- elbv2($operation:Str, $param:HashRef, %opt:Hash)
- emr($operation:Str, $param:HashRef, %opt:Hash)
- emr_containers($operation:Str, $param:HashRef, %opt:Hash)
- emr_serverless($operation:Str, $param:HashRef, %opt:Hash)
- es($operation:Str, $param:HashRef, %opt:Hash)
- events($operation:Str, $param:HashRef, %opt:Hash)
- evidently($operation:Str, $param:HashRef, %opt:Hash)
- finspace($operation:Str, $param:HashRef, %opt:Hash)
- finspace_data($operation:Str, $param:HashRef, %opt:Hash)
- firehose($operation:Str, $param:HashRef, %opt:Hash)
- fis($operation:Str, $param:HashRef, %opt:Hash)
- fms($operation:Str, $param:HashRef, %opt:Hash)
- forecast($operation:Str, $param:HashRef, %opt:Hash)
- forecastquery($operation:Str, $param:HashRef, %opt:Hash)
- frauddetector($operation:Str, $param:HashRef, %opt:Hash)
- fsx($operation:Str, $param:HashRef, %opt:Hash)
- gamelift($operation:Str, $param:HashRef, %opt:Hash)
- gamesparks($operation:Str, $param:HashRef, %opt:Hash)
- glacier($operation:Str, $param:HashRef, %opt:Hash)
- globalaccelerator($operation:Str, $param:HashRef, %opt:Hash)
- glue($operation:Str, $param:HashRef, %opt:Hash)
- grafana($operation:Str, $param:HashRef, %opt:Hash)
- greengrass($operation:Str, $param:HashRef, %opt:Hash)
- greengrassv2($operation:Str, $param:HashRef, %opt:Hash)
- groundstation($operation:Str, $param:HashRef, %opt:Hash)
- guardduty($operation:Str, $param:HashRef, %opt:Hash)
- health($operation:Str, $param:HashRef, %opt:Hash)
- healthlake($operation:Str, $param:HashRef, %opt:Hash)
- history($operation:Str, $param:HashRef, %opt:Hash)
- honeycode($operation:Str, $param:HashRef, %opt:Hash)
- iam($operation:Str, $param:HashRef, %opt:Hash)
- identitystore($operation:Str, $param:HashRef, %opt:Hash)
- imagebuilder($operation:Str, $param:HashRef, %opt:Hash)
- importexport($operation:Str, $param:HashRef, %opt:Hash)
- inspector($operation:Str, $param:HashRef, %opt:Hash)
- inspector2($operation:Str, $param:HashRef, %opt:Hash)
- internetmonitor($operation:Str, $param:HashRef, %opt:Hash)
- iot($operation:Str, $param:HashRef, %opt:Hash)
- iot_data($operation:Str, $param:HashRef, %opt:Hash)
- iot_jobs_data($operation:Str, $param:HashRef, %opt:Hash)
- iot_roborunner($operation:Str, $param:HashRef, %opt:Hash)
- iot1click_devices($operation:Str, $param:HashRef, %opt:Hash)
- iot1click_projects($operation:Str, $param:HashRef, %opt:Hash)
- iotanalytics($operation:Str, $param:HashRef, %opt:Hash)
- iotdeviceadvisor($operation:Str, $param:HashRef, %opt:Hash)
- iotevents($operation:Str, $param:HashRef, %opt:Hash)
- iotevents_data($operation:Str, $param:HashRef, %opt:Hash)
- iotfleethub($operation:Str, $param:HashRef, %opt:Hash)
- iotfleetwise($operation:Str, $param:HashRef, %opt:Hash)
- iotsecuretunneling($operation:Str, $param:HashRef, %opt:Hash)
- iotsitewise($operation:Str, $param:HashRef, %opt:Hash)
- iotthingsgraph($operation:Str, $param:HashRef, %opt:Hash)
- iottwinmaker($operation:Str, $param:HashRef, %opt:Hash)
- iotwireless($operation:Str, $param:HashRef, %opt:Hash)
- ivs($operation:Str, $param:HashRef, %opt:Hash)
- ivs_realtime($operation:Str, $param:HashRef, %opt:Hash)
- ivschat($operation:Str, $param:HashRef, %opt:Hash)
- kafka($operation:Str, $param:HashRef, %opt:Hash)
- kafkaconnect($operation:Str, $param:HashRef, %opt:Hash)
- kendra($operation:Str, $param:HashRef, %opt:Hash)
- kendra_ranking($operation:Str, $param:HashRef, %opt:Hash)
- keyspaces($operation:Str, $param:HashRef, %opt:Hash)
- kinesis($operation:Str, $param:HashRef, %opt:Hash)
- kinesis_video_archived_media($operation:Str, $param:HashRef, %opt:Hash)
- kinesis_video_media($operation:Str, $param:HashRef, %opt:Hash)
- kinesis_video_signaling($operation:Str, $param:HashRef, %opt:Hash)
- kinesis_video_webrtc_storage($operation:Str, $param:HashRef, %opt:Hash)
- kinesisanalytics($operation:Str, $param:HashRef, %opt:Hash)
- kinesisanalyticsv2($operation:Str, $param:HashRef, %opt:Hash)
- kinesisvideo($operation:Str, $param:HashRef, %opt:Hash)
- kms($operation:Str, $param:HashRef, %opt:Hash)
- lakeformation($operation:Str, $param:HashRef, %opt:Hash)
- lambda($operation:Str, $param:HashRef, %opt:Hash)
- lex_models($operation:Str, $param:HashRef, %opt:Hash)
- lex_runtime($operation:Str, $param:HashRef, %opt:Hash)
- lexv2_models($operation:Str, $param:HashRef, %opt:Hash)
- lexv2_runtime($operation:Str, $param:HashRef, %opt:Hash)
- license_manager($operation:Str, $param:HashRef, %opt:Hash)
- license_manager_linux_subscriptions($operation:Str, $param:HashRef, %opt:Hash)
- license_manager_user_subscriptions($operation:Str, $param:HashRef, %opt:Hash)
- lightsail($operation:Str, $param:HashRef, %opt:Hash)
- location($operation:Str, $param:HashRef, %opt:Hash)
- logs($operation:Str, $param:HashRef, %opt:Hash)
- lookoutequipment($operation:Str, $param:HashRef, %opt:Hash)
- lookoutmetrics($operation:Str, $param:HashRef, %opt:Hash)
- lookoutvision($operation:Str, $param:HashRef, %opt:Hash)
- m2($operation:Str, $param:HashRef, %opt:Hash)
- machinelearning($operation:Str, $param:HashRef, %opt:Hash)
- macie($operation:Str, $param:HashRef, %opt:Hash)
- macie2($operation:Str, $param:HashRef, %opt:Hash)
- managedblockchain($operation:Str, $param:HashRef, %opt:Hash)
- marketplace_catalog($operation:Str, $param:HashRef, %opt:Hash)
- marketplace_entitlement($operation:Str, $param:HashRef, %opt:Hash)
- marketplacecommerceanalytics($operation:Str, $param:HashRef, %opt:Hash)
- mediaconnect($operation:Str, $param:HashRef, %opt:Hash)
- mediaconvert($operation:Str, $param:HashRef, %opt:Hash)
- medialive($operation:Str, $param:HashRef, %opt:Hash)
- mediapackage($operation:Str, $param:HashRef, %opt:Hash)
- mediapackage_vod($operation:Str, $param:HashRef, %opt:Hash)
- mediapackagev2($operation:Str, $param:HashRef, %opt:Hash)
- mediastore($operation:Str, $param:HashRef, %opt:Hash)
- mediastore_data($operation:Str, $param:HashRef, %opt:Hash)
- mediatailor($operation:Str, $param:HashRef, %opt:Hash)
- memorydb($operation:Str, $param:HashRef, %opt:Hash)
- meteringmarketplace($operation:Str, $param:HashRef, %opt:Hash)
- mgh($operation:Str, $param:HashRef, %opt:Hash)
- mgn($operation:Str, $param:HashRef, %opt:Hash)
- migration_hub_refactor_spaces($operation:Str, $param:HashRef, %opt:Hash)
- migrationhub_config($operation:Str, $param:HashRef, %opt:Hash)
- migrationhuborchestrator($operation:Str, $param:HashRef, %opt:Hash)
- migrationhubstrategy($operation:Str, $param:HashRef, %opt:Hash)
- mobile($operation:Str, $param:HashRef, %opt:Hash)
- mq($operation:Str, $param:HashRef, %opt:Hash)
- mturk($operation:Str, $param:HashRef, %opt:Hash)
- mwaa($operation:Str, $param:HashRef, %opt:Hash)
- neptune($operation:Str, $param:HashRef, %opt:Hash)
- network_firewall($operation:Str, $param:HashRef, %opt:Hash)
- networkmanager($operation:Str, $param:HashRef, %opt:Hash)
- nimble($operation:Str, $param:HashRef, %opt:Hash)
- oam($operation:Str, $param:HashRef, %opt:Hash)
- omics($operation:Str, $param:HashRef, %opt:Hash)
- opensearch($operation:Str, $param:HashRef, %opt:Hash)
- opensearchserverless($operation:Str, $param:HashRef, %opt:Hash)
- opsworks($operation:Str, $param:HashRef, %opt:Hash)
- opsworks_cm($operation:Str, $param:HashRef, %opt:Hash)
- organizations($operation:Str, $param:HashRef, %opt:Hash)
- osis($operation:Str, $param:HashRef, %opt:Hash)
- outposts($operation:Str, $param:HashRef, %opt:Hash)
- panorama($operation:Str, $param:HashRef, %opt:Hash)
- payment_cryptography($operation:Str, $param:HashRef, %opt:Hash)
- payment_cryptography_data($operation:Str, $param:HashRef, %opt:Hash)
- personalize($operation:Str, $param:HashRef, %opt:Hash)
- personalize_events($operation:Str, $param:HashRef, %opt:Hash)
- personalize_runtime($operation:Str, $param:HashRef, %opt:Hash)
- pi($operation:Str, $param:HashRef, %opt:Hash)
- pinpoint($operation:Str, $param:HashRef, %opt:Hash)
- pinpoint_email($operation:Str, $param:HashRef, %opt:Hash)
- pinpoint_sms_voice($operation:Str, $param:HashRef, %opt:Hash)
- pinpoint_sms_voice_v2($operation:Str, $param:HashRef, %opt:Hash)
- pipes($operation:Str, $param:HashRef, %opt:Hash)
- polly($operation:Str, $param:HashRef, %opt:Hash)
- pricing($operation:Str, $param:HashRef, %opt:Hash)
- privatenetworks($operation:Str, $param:HashRef, %opt:Hash)
- proton($operation:Str, $param:HashRef, %opt:Hash)
- qldb($operation:Str, $param:HashRef, %opt:Hash)
- qldb_session($operation:Str, $param:HashRef, %opt:Hash)
- quicksight($operation:Str, $param:HashRef, %opt:Hash)
- ram($operation:Str, $param:HashRef, %opt:Hash)
- rbin($operation:Str, $param:HashRef, %opt:Hash)
- rds($operation:Str, $param:HashRef, %opt:Hash)
- rds_data($operation:Str, $param:HashRef, %opt:Hash)
- redshift($operation:Str, $param:HashRef, %opt:Hash)
- redshift_data($operation:Str, $param:HashRef, %opt:Hash)
- redshift_serverless($operation:Str, $param:HashRef, %opt:Hash)
- rekognition($operation:Str, $param:HashRef, %opt:Hash)
- resiliencehub($operation:Str, $param:HashRef, %opt:Hash)
- resource_explorer_2($operation:Str, $param:HashRef, %opt:Hash)
- resource_groups($operation:Str, $param:HashRef, %opt:Hash)
- resourcegroupstaggingapi($operation:Str, $param:HashRef, %opt:Hash)
- robomaker($operation:Str, $param:HashRef, %opt:Hash)
- rolesanywhere($operation:Str, $param:HashRef, %opt:Hash)
- route53($operation:Str, $param:HashRef, %opt:Hash)
- route53_recovery_cluster($operation:Str, $param:HashRef, %opt:Hash)
- route53_recovery_control_config($operation:Str, $param:HashRef, %opt:Hash)
- route53_recovery_readiness($operation:Str, $param:HashRef, %opt:Hash)
- route53domains($operation:Str, $param:HashRef, %opt:Hash)
- route53resolver($operation:Str, $param:HashRef, %opt:Hash)
- rum($operation:Str, $param:HashRef, %opt:Hash)
- s3($operation:Str, $path:ArrayRef, $param:HashRef, %opt:Hash)
- s3api($operation:Str, $param:HashRef, %opt:Hash)
- s3control($operation:Str, $param:HashRef, %opt:Hash)
- s3outposts($operation:Str, $param:HashRef, %opt:Hash)
- sagemaker($operation:Str, $param:HashRef, %opt:Hash)
- sagemaker_a2i_runtime($operation:Str, $param:HashRef, %opt:Hash)
- sagemaker_edge($operation:Str, $param:HashRef, %opt:Hash)
- sagemaker_featurestore_runtime($operation:Str, $param:HashRef, %opt:Hash)
- sagemaker_geospatial($operation:Str, $param:HashRef, %opt:Hash)
- sagemaker_metrics($operation:Str, $param:HashRef, %opt:Hash)
- sagemaker_runtime($operation:Str, $param:HashRef, %opt:Hash)
- savingsplans($operation:Str, $param:HashRef, %opt:Hash)
- scheduler($operation:Str, $param:HashRef, %opt:Hash)
- schemas($operation:Str, $param:HashRef, %opt:Hash)
- sdb($operation:Str, $param:HashRef, %opt:Hash)
- secretsmanager($operation:Str, $param:HashRef, %opt:Hash)
- securityhub($operation:Str, $param:HashRef, %opt:Hash)
- securitylake($operation:Str, $param:HashRef, %opt:Hash)
- serverlessrepo($operation:Str, $param:HashRef, %opt:Hash)
- service_quotas($operation:Str, $param:HashRef, %opt:Hash)
- servicecatalog($operation:Str, $param:HashRef, %opt:Hash)
- servicecatalog_appregistry($operation:Str, $param:HashRef, %opt:Hash)
- servicediscovery($operation:Str, $param:HashRef, %opt:Hash)
- ses($operation:Str, $param:HashRef, %opt:Hash)
- sesv2($operation:Str, $param:HashRef, %opt:Hash)
- shield($operation:Str, $param:HashRef, %opt:Hash)
- signer($operation:Str, $param:HashRef, %opt:Hash)
- simspaceweaver($operation:Str, $param:HashRef, %opt:Hash)
- sms($operation:Str, $param:HashRef, %opt:Hash)
- snow_device_management($operation:Str, $param:HashRef, %opt:Hash)
- snowball($operation:Str, $param:HashRef, %opt:Hash)
- sns($operation:Str, $param:HashRef, %opt:Hash)
- sqs($operation:Str, $param:HashRef, %opt:Hash)
- ssm($operation:Str, $param:HashRef, %opt:Hash)
- ssm_contacts($operation:Str, $param:HashRef, %opt:Hash)
- ssm_incidents($operation:Str, $param:HashRef, %opt:Hash)
- ssm_sap($operation:Str, $param:HashRef, %opt:Hash)
- sso($operation:Str, $param:HashRef, %opt:Hash)
- sso_admin($operation:Str, $param:HashRef, %opt:Hash)
- sso_oidc($operation:Str, $param:HashRef, %opt:Hash)
- stepfunctions($operation:Str, $param:HashRef, %opt:Hash)
- storagegateway($operation:Str, $param:HashRef, %opt:Hash)
- sts($operation:Str, $param:HashRef, %opt:Hash)
- support($operation:Str, $param:HashRef, %opt:Hash)
- support_app($operation:Str, $param:HashRef, %opt:Hash)
- swf($operation:Str, $param:HashRef, %opt:Hash)
- synthetics($operation:Str, $param:HashRef, %opt:Hash)
- textract($operation:Str, $param:HashRef, %opt:Hash)
- timestream_query($operation:Str, $param:HashRef, %opt:Hash)
- timestream_write($operation:Str, $param:HashRef, %opt:Hash)
- tnb($operation:Str, $param:HashRef, %opt:Hash)
- transcribe($operation:Str, $param:HashRef, %opt:Hash)
- transfer($operation:Str, $param:HashRef, %opt:Hash)
- translate($operation:Str, $param:HashRef, %opt:Hash)
- verifiedpermissions($operation:Str, $param:HashRef, %opt:Hash)
- voice_id($operation:Str, $param:HashRef, %opt:Hash)
- vpc_lattice($operation:Str, $param:HashRef, %opt:Hash)
- waf($operation:Str, $param:HashRef, %opt:Hash)
- waf_regional($operation:Str, $param:HashRef, %opt:Hash)
- wafv2($operation:Str, $param:HashRef, %opt:Hash)
- wellarchitected($operation:Str, $param:HashRef, %opt:Hash)
- wisdom($operation:Str, $param:HashRef, %opt:Hash)
- workdocs($operation:Str, $param:HashRef, %opt:Hash)
- worklink($operation:Str, $param:HashRef, %opt:Hash)
- workmail($operation:Str, $param:HashRef, %opt:Hash)
- workmailmessageflow($operation:Str, $param:HashRef, %opt:Hash)
- workspaces($operation:Str, $param:HashRef, %opt:Hash)
- workspaces_web($operation:Str, $param:HashRef, %opt:Hash)
- xray($operation:Str, $param:HashRef, %opt:Hash)
-
AWS::CLIWrapper provides methods same as services of aws-cli. Please refer to `aws help`.
First arg "operation" is same as operation of aws-cli. Please refer to `aws SERVICE help`.
Second arg "param" is same as command line option of aws-cli. Please refer to `aws SERVICE OPERATION help`.
Key of param is string that trimmed leading "--" and replaced "-" to "_" for command line option (--instance-ids -> instance_ids). Value of param is SCALAR or ARRAYREF or HASHREF.
You can specify
(boolean)
parameter by$AWS::CLIWrapper::true
or$AWS::CLIWrapper::false
.my $res = $aws->ec2('assign-private-ip-addresses', { network_interface_id => $eni_id, private_ip_addresses => [ $private_ip_1, $private_ip_2 ], allow_reassignment => $AWS::CLIWrapper::true, })
Special case: several OPERATIONs take a single arg. For example "aws s3api get-object ... output_file". In this case, You can specify below using
output_file
key:my $res = $aws->s3api('get-object', { bucket => 'my-bucket', key => 'blahblahblah', output_file => '/path/to/output/file', })
Special case: s3 OPERATION takes one or two arguments in addition to options. For example "aws s3 cp LocalPath s3://S3Path". Pass an extra ARRAYREF to the s3 method in this case:
my $res = $aws->s3('cp', ['LocalPath', 's3://S3Path'], { exclude => '*.bak', })
Special case: s3 OPERATION can take --include and --exclude option multiple times. For example "aws s3 sync --exclude 'foo' --exclude 'bar' LocalPath s3://S3Path", Pass ARRAYREF as value of
include
orexclude
in this case:my $res = $aws->s3('sync', ['LocalPath', 's3://S3Path'], { exclude => ['foo', 'bar'], })
Third arg "opt" is optional. Available key/values are below:
timeout => Int Maximum time the "aws" command is allowed to run before aborting. default is 30 seconds, unless overridden with AWS_CLIWRAPPER_TIMEOUT environment variable. nofork => Int (>0) Call IPC::Cmd::run vs. IPC::Cmd::run_forked (mostly useful if/when in perl debugger). Note: 'timeout', if used with 'nofork', will merely cause an alarm and return. ie. 'run' will NOT kill the awscli command like 'run_forked' will. croak_on_error => Int (>0) When set to a truthy value, this will make AWS::CLIWrapper to croak() with error message when `aws` command exits with non-zero status. Default behavior is to set $AWS::CLIWrapper::Error and return. catch_error_pattern => RegExp When defined, this option will enable catching `aws-cli` errors matching this pattern and retrying `aws-cli` command execution. Environment variable AWS_CLIWRAPPER_CATCH_ERROR_PATTERN takes precedence over this option, if both are defined. Default is undef. catch_error_retries => Int (>= 0) When defined, this option will set the number of retries to make when `aws-cli` error was caught with catch_error_pattern, before giving up. Environment variable AWS_CLIWRAPPER_CATCH_ERROR_RETRIES takes precedence over this option, if both are defined. 0 (zero) retries is a valid way to turn off error catching via environment variable in certain scenarios. Negative values are invalid and will be reset to default. Default is 3. catch_error_min_delay => Int (>= 0) When defined, this option will set the minimum delay in seconds before attempting a retry of failed `aws-cli` execution when the error was caught. Environment variable AWS_CLIWRAPPER_CATCH_ERROR_MIN_DELAY takes precedence over this option, if both are defined. 0 (zero) is a valid value. Negative values are invalid and will be reset to default. Default is 3. catch_error_max_delay => Int (>= 0) When defined, this option will set the maximum delay in seconds before attempting a retry of failed `aws-cli` execution. Environment variable AWS_CLIWRAPPER_CATCH_ERROR_MAX_DELAY takes precedence over this option, if both are defined. 0 (zero) is a valid value. Negative values are invalid and will be reset to default. If catch_error_min_delay is greater than catch_error_max_delay, both are set to catch_error_min_delay value. Default is 10.
ENVIRONMENT
- HOME: used by default by /usr/bin/aws utility to find it's credentials (if none are specified)
-
Special note: cron on Linux will often have a different HOME "/" instead of "/root" - set $ENV{'HOME'} to use the default credentials or specify $ENV{'AWS_CONFIG_FILE'} directly.
- AWS_CLIWRAPPER_TIMEOUT
-
If this variable is set, this value will be used instead of default timeout (30 seconds) for every invocation of `aws-cli` that does not have a timeout value provided in the options argument of the called function.
- AWS_CLIWRAPPER_CATCH_ERROR_PATTERN
-
If this variable is set, AWS::CLIWrapper will retry `aws-cli` execution if stdout output of failed `aws-cli` command matches the pattern. See "ERROR HANDLING".
- AWS_CLIWRAPPER_CATCH_ERROR_RETRIES
-
How many times to retry command execution if an error was caught. Default is 3.
- AWS_CLIWRAPPER_CATCH_ERROR_MIN_DELAY
-
Minimal delay before retrying command execution if an error was caught, in seconds.
Default is 3.
- AWS_CLIWRAPPER_CATCH_ERROR_MAX_DELAY
-
Maximal delay before retrying command execution, in seconds. Default is 10.
- AWS_CONFIG_FILE
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_DEFAULT_REGION
-
See documents of aws-cli.
ERROR HANDLING
By default, when `aws-cli` exits with an error code (> 0), AWS::CLIWrapper will set the error code and message to $AWS::CLIWrapper::Error (and optionally croak), thus relaying the error to calling code. While this approach is beneficial 99% of the time, in some use cases `aws-cli` execution fails for a temporary reason unrelated to both calling code and AWS::CLIWrapper, and can be safely retried after a short delay.
One of this use cases is executing `aws-cli` on AWS EC2 instances, where `aws-cli` retrieves its configuration and credentials from the API exposed to the EC2 instance; at certain times these credentials may be rotated and calling `aws-cli` at exactly the right moment will cause it to fail with `Unable to locate credentials` error.
To prevent this kind of errors from failing the calling code, AWS::CLIWrapper allows configuring an RegExp pattern and retry `aws-cli` execution if it fails with an error matching the configured pattern.
The error catching pattern, as well as other configuration, can be defined either as AWS::CLIWrapper options in the code, or as respective environment variables (see ENVIRONMENT).
The actual delay before retrying a failed `aws-cli` execution is computed as a random value of seconds between catch_error_min_delay (default 3) and catch_error_max_delay (default 10). Backoff is not supported at this moment.
AUTHOR
HIROSE Masaaki <hirose31 _at_ gmail.com>
REPOSITORY
https://github.com/hirose31/AWS-CLIWrapper
git clone git://github.com/hirose31/AWS-CLIWrapper.git
patches and collaborators are welcome.
SEE ALSO
http://aws.amazon.com/cli/, https://github.com/aws/aws-cli, http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Welcome.html, https://github.com/boto/botocore,
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.