AWS-Lambda

 view release on metacpan or  search on metacpan

author/update-aws-lambda-al.pl  view on Meta::CPAN

    $layers->{$version}{$region} = $arn;
});

for my $version (@$versions) {
    for my $region (@{$regions->{x86_64}}) {
        say STDERR "loading $version in $region...";
        $pm->start("$version/$region") and next;

        my $runtime_stack = "lambda-@{[ $version =~ s/[.]/-/r ]}-runtime";
        my $paws_stack = "lambda-@{[ $version =~ s/[.]/-/r ]}-paws";
        my ($stdout, $stderr, $exit);

        ($stdout, $stderr, $exit) = capture {
            system("aws --region $region cloudformation describe-stacks --output json --stack-name $runtime_stack | jq -r .Stacks[0].Outputs[0].OutputValue");
        };
        if ($exit != 0) {
            if ($stderr =~ /ValidationError/) {
                # the stack doesn't exist; skip it.
                $pm->finish;
                next;
            }
            die "failed to execute aws cli";
        }
        my $runtime_arn = $stdout;

        ($stdout, $stderr, $exit) = capture {
            system("aws --region $region cloudformation describe-stacks --output json --stack-name $paws_stack | jq -r .Stacks[0].Outputs[0].OutputValue");
        };
        if ($exit != 0) {
            if ($stderr =~ /ValidationError/) {
                # the stack doesn't exist; skip it.
                $pm->finish;
                next;
            }
            die "failed to execute aws cli";
        }
        my $paws_arn = $stdout;
 
        chomp($runtime_arn);
        chomp($paws_arn);

author/update-aws-lambda-al2.pl  view on Meta::CPAN

    $layers_al2_x86_64->{$version}{$region} = $arn;
});

for my $version (@$versions_al2) {
    for my $region (@{$regions->{x86_64}}) {
        say STDERR "loading $version in $region...";
        $pm_al2_x86_64->start("$version/$region") and next;

        my $runtime_stack = "lambda-$version-runtime-al2" =~ s/[._]/-/gr;
        my $paws_stack = "lambda-$version-paws-al2" =~ s/[._]/-/gr;
        my ($stdout, $stderr, $exit);

        ($stdout, $stderr, $exit) = capture {
            system("aws --region $region cloudformation describe-stacks --output json --stack-name $runtime_stack | jq -r .Stacks[0].Outputs[0].OutputValue");
        };
        if ($exit != 0) {
            if ($stderr =~ /ValidationError/) {
                # the stack doesn't exist; skip it.
                $pm_al2_x86_64->finish;
                next;
            }
            die "failed to execute aws cli";
        }
        my $runtime_arn = $stdout;

        ($stdout, $stderr, $exit) = capture {
            system("aws --region $region cloudformation describe-stacks --output json --stack-name $paws_stack | jq -r .Stacks[0].Outputs[0].OutputValue");
        };
        if ($exit != 0) {
            if ($stderr =~ /ValidationError/) {
                # the stack doesn't exist; skip it.
                $pm_al2_x86_64->finish;
                next;
            }
            die "failed to execute aws cli";
        }
        my $paws_arn = $stdout;
 
        chomp($runtime_arn);
        chomp($paws_arn);

author/update-aws-lambda-al2.pl  view on Meta::CPAN

});

for my $version (@$versions_al2) {
    for my $arch (@$archs) {
        for my $region (@{$regions->{$arch}}) {
            say STDERR "loading $version in $region...";
            $pm_al2->start("$version/$region/$arch") and next;

            my $runtime_stack = "lambda-$version-runtime-al2-$arch" =~ s/[._]/-/gr;
            my $paws_stack = "lambda-$version-paws-al2-$arch" =~ s/[._]/-/gr;
            my ($stdout, $stderr, $exit);

            ($stdout, $stderr, $exit) = capture {
                system("aws --region $region cloudformation describe-stacks --output json --stack-name $runtime_stack | jq -r .Stacks[0].Outputs[0].OutputValue");
            };
            if ($exit != 0) {
                if ($stderr =~ /ValidationError/) {
                    # the stack doesn't exist; skip it.
                    $pm_al2->finish;
                    next;
                }
                die "failed to execute aws cli";
            }
            my $runtime_arn = $stdout;

            ($stdout, $stderr, $exit) = capture {
                system("aws --region $region cloudformation describe-stacks --output json --stack-name $paws_stack | jq -r .Stacks[0].Outputs[0].OutputValue");
            };
            if ($exit != 0) {
                if ($stderr =~ /ValidationError/) {
                    # the stack doesn't exist; skip it.
                    $pm_al2->finish;
                    next;
                }
                die "failed to execute aws cli";
            }
            my $paws_arn = $stdout;

            chomp($runtime_arn);
            chomp($paws_arn);

author/update-aws-lambda-al2023.pl  view on Meta::CPAN

});

for my $version (@$versions_al2023) {
    for my $arch (@$archs) {
        for my $region (@{$regions->{$arch}}) {
            say STDERR "loading $version in $region...";
            $pm_al2023->start("$version/$region/$arch") and next;

            my $runtime_stack = "lambda-$version-runtime-al2023-$arch" =~ s/[._]/-/gr;
            my $paws_stack = "lambda-$version-paws-al2023-$arch" =~ s/[._]/-/gr;
            my ($stdout, $stderr, $exit);

            ($stdout, $stderr, $exit) = capture {
                system("aws --region $region cloudformation describe-stacks --output json --stack-name $runtime_stack | jq -r .Stacks[0].Outputs[0].OutputValue");
            };
            if ($exit != 0) {
                if ($stderr =~ /ValidationError/) {
                    # the stack doesn't exist; skip it.
                    $pm_al2023->finish;
                    next;
                }
                die "failed to execute aws cli";
            }
            my $runtime_arn = $stdout;

            ($stdout, $stderr, $exit) = capture {
                system("aws --region $region cloudformation describe-stacks --output json --stack-name $paws_stack | jq -r .Stacks[0].Outputs[0].OutputValue");
            };
            if ($exit != 0) {
                if ($stderr =~ /ValidationError/) {
                    # the stack doesn't exist; skip it.
                    $pm_al2023->finish;
                    next;
                }
                die "failed to execute aws cli";
            }
            my $paws_arn = $stdout;

            chomp($runtime_arn);
            chomp($paws_arn);

author/validate-account.sh  view on Meta::CPAN

#!/usr/bin/env bash

set -xue

AWS_ACCOUNT=$(aws sts get-caller-identity | jq -r .Account)

if [[ "$AWS_ACCOUNT" != 445285296882 ]]; then
    echo "Invalid AWS Account: $AWS_ACCOUNT" > /dev/stderr
    exit 2
fi



( run in 1.212 second using v1.01-cache-2.11-cpan-49f99fa48dc )