AWS-Lambda
view release on metacpan or search on metacpan
0.0.25 2021-03-02T05:32:05Z
- new region Asia Pacific (Osaka) ap-northeast-3 is available
- custom registry name https://gallery.ecr.aws/shogo82148/p5-aws-lambda is now available
- old one https://gallery.ecr.aws/w2s0h5h2/p5-aws-lambda is still alive
0.0.24 2021-01-25T10:18:13Z
- perl 5.32.1 is released
0.0.23 2021-01-02T02:20:42Z
- support Container Image format https://aws.amazon.com/jp/blogs/aws/new-for-aws-lambda-container-image-support/
0.0.22 2020-08-15T04:48:07Z
- Perl 5.32.0 on Amazon Linux 2 is released
0.0.21 2020-06-22T11:24:18Z
- Nothing changes. I mistook releasing v0.0.20 and v0.0.19
0.0.20 2020-06-21T01:48:12Z
- Perl 5.32.0 is released
$ docker run -p 9000:8080 hello-perl:latest
Now, you can test a function invocation with cURL.
$ curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'
To upload the container image, you need to create a new ECR repository in your account and tag the local image to push it to ECR.
$ aws ecr create-repository --repository-name hello-perl --image-scanning-configuration scanOnPush=true
$ docker tag hello-perl:latest 123412341234.dkr.ecr.sa-east-1.amazonaws.com/hello-perl:latest
$ aws ecr get-login-password | docker login --username AWS --password-stdin 123412341234.dkr.ecr.sa-east-1.amazonaws.com
$ docker push 123412341234.dkr.ecr.sa-east-1.amazonaws.com/hello-perl:latest
Finally, create new function using awscli.
$ aws --region "$REGION" --profile "$PROFILE" lambda create-function \
--function-name "hello-perl" \
--code ImageUri=123412341234.dkr.ecr.sa-east-1.amazonaws.com/hello-perl:latest \
--handler "handler.handle" \
--runtime provided.al2023 \
--role arn:aws:iam::xxxxxxxxxxxx:role/service-role/lambda-custom-runtime-perl-role
examples/cgi/WwwCounter/gifcat.pl view on Meta::CPAN
$pflag = 0;
}
;# =====================================================
;# gifcat'gifcat() - get a concatenated GIF image.
;# =====================================================
sub gifcat {
@files = @_;
$Gif = 0;
$leftpos = 0;
$logicalScreenWidth = 0;
$logicalScreenHeight = 0;
$useLocalColorTable = 0;
foreach $file (@files) {
$size = -s $file;
open(IN, "$file") || return("ERROR");
binmode(IN);
read(IN, $buf, $size) || return("ERROR");
close(IN);
$cnt = 0;
examples/cgi/WwwCounter/gifcat.pl view on Meta::CPAN
}
undef($buf);
$Gif++;
}
if ($pflag == 1) {
return;
}
$GifImage = "GIF89a";
$GifImage .= pack("C", $logicalScreenWidth & 0x00ff);
$GifImage .= pack("C", ($logicalScreenWidth & 0xff00) >> 8);
$GifImage .= pack("C", $logicalScreenHeight & 0x00ff);
$GifImage .= pack("C", ($logicalScreenHeight & 0xff00) >> 8);
if ($useLocalColorTable) {
$PackedFields18[0] &= ~0x80;
}
$GifImage .= pack("C", $PackedFields18[0]);
$GifImage .= pack("C", $BackgroundColorIndex);
$GifImage .= pack("C", $PixelAspectRatio);
if ($useLocalColorTable == 0) {
$GifImage .= $globalColorTable[0];
}
for ($i = -1; $i < $Gif; $i++) {
examples/cgi/WwwCounter/gifcat.pl view on Meta::CPAN
$BackgroundColorIndex = ord(substr($buf, $cnt, 1)); $cnt++;
$PixelAspectRatio = ord(substr($buf, $cnt, 1)); $cnt++;
if ($GlobalColorTableFlag) {
$GlobalColorTable
= substr($buf, $cnt, $SizeOfGlobalColorTable * 3);
$cnt += $SizeOfGlobalColorTable * 3;
} else {
$GlobalColorTable = "";
}
$logicalScreenWidth += $LogicalScreenWidth;
if ($logicalScreenHeight < $LogicalScreenHeight) {
$logicalScreenHeight = $LogicalScreenHeight;
}
if ($GlobalColorTableFlag) {
$globalColorTable[$Gif] = $GlobalColorTable;
if ($Gif > 0) {
if ($GlobalColorTable ne $globalColorTable[$Gif - 1]) {
$useLocalColorTable = 1;
}
}
}
examples/cgi/WwwCounter/sample.html view on Meta::CPAN
<h4>SSIããã¹ãã«ã¦ã³ã¿ã¼</h4>
<div class="i">
ããªã㯠<!--#exec cgi="wwwcount.cgi text"--> 人ç®ã®ã客æ§ã§ãã<br>
(SSI ããµãã¼ãããã¦ããå ´åã®ã¿è¡¨ç¤ºããã¾ãã)
</div>
<h4>ãªã³ã¯å
çºè¦æ©è½ï¼CGIçï¼</h4>
<div class="i">
ããªãã¯
<script>
console.log(document.referrer);
var ref = document.referrer;
ref = ref.replace(/ /, "%20");
ref = ref.replace(/\+/, "%2B");
ref = ref.replace(/\?/, "%3F");
console.log(ref);
document.write("<img width=96 height=18 src='wwwcount.cgi?gif+ref+" + ref + "' alt='counter'>");
</script>
人ç®ã®ã客æ§ã§ãã
</div>
<h4>é ãã«ã¦ã³ã¿ã¼</h4>
<div class="i">
<img src="wwwcount.cgi?hide+trees.gif" width=25 height=25>
</div>
examples/custom-docker/README.md view on Meta::CPAN
# An Example of Custom Docker Images
Build the hello-perl container image locally:
$ docker build -t hello-perl .
To upload the container image, you need to create a new ECR repository in your account and tag the local image to push it to ECR.
$ aws ecr create-repository --repository-name hello-perl --image-scanning-configuration scanOnPush=true
$ docker tag hello-perl:latest 123412341234.dkr.ecr.sa-east-1.amazonaws.com/hello-perl:latest
$ aws ecr get-login-password | docker login --username AWS --password-stdin 123412341234.dkr.ecr.sa-east-1.amazonaws.com
$ docker push 123412341234.dkr.ecr.sa-east-1.amazonaws.com/hello-perl:latest
Finally, create new function using awscli.
$ aws --region "$REGION" --profile "$PROFILE" lambda create-function \
--function-name "hello-perl" \
--code ImageUri=123412341234.dkr.ecr.sa-east-1.amazonaws.com/hello-perl:latest \
--handler "handler.handle" \
--runtime provided.al2 \
--role arn:aws:iam::xxxxxxxxxxxx:role/service-role/lambda-custom-runtime-perl-role
examples/docker/README.md view on Meta::CPAN
$ docker run -p 9000:8080 hello-perl:latest
Now, you can test a function invocation with cURL.
$ curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'
To upload the container image, you need to create a new ECR repository in your account and tag the local image to push it to ECR.
$ aws ecr create-repository --repository-name hello-perl --image-scanning-configuration scanOnPush=true
$ docker tag hello-perl:latest 123412341234.dkr.ecr.sa-east-1.amazonaws.com/hello-perl:latest
$ aws ecr get-login-password | docker login --username AWS --password-stdin 123412341234.dkr.ecr.sa-east-1.amazonaws.com
$ docker push 123412341234.dkr.ecr.sa-east-1.amazonaws.com/hello-perl:latest
Finally, create new function using awscli.
$ aws --region "$REGION" --profile "$PROFILE" lambda create-function \
--function-name "hello-perl" \
--code ImageUri=123412341234.dkr.ecr.sa-east-1.amazonaws.com/hello-perl:latest \
--handler "handler.handle" \
--runtime provided.al2 \
--role arn:aws:iam::xxxxxxxxxxxx:role/service-role/lambda-custom-runtime-perl-role
lib/AWS/Lambda.pm view on Meta::CPAN
$ docker run -p 9000:8080 hello-perl:latest
Now, you can test a function invocation with cURL.
$ curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'
To upload the container image, you need to create a new ECR repository in your account and tag the local image to push it to ECR.
$ aws ecr create-repository --repository-name hello-perl --image-scanning-configuration scanOnPush=true
$ docker tag hello-perl:latest 123412341234.dkr.ecr.sa-east-1.amazonaws.com/hello-perl:latest
$ aws ecr get-login-password | docker login --username AWS --password-stdin 123412341234.dkr.ecr.sa-east-1.amazonaws.com
$ docker push 123412341234.dkr.ecr.sa-east-1.amazonaws.com/hello-perl:latest
Finally, create new function using awscli.
$ aws --region "$REGION" --profile "$PROFILE" lambda create-function \
--function-name "hello-perl" \
--code ImageUri=123412341234.dkr.ecr.sa-east-1.amazonaws.com/hello-perl:latest \
--handler "handler.handle" \
--runtime provided.al2023 \
--role arn:aws:iam::xxxxxxxxxxxx:role/service-role/lambda-custom-runtime-perl-role
lib/AWS/Lambda/Context.pm view on Meta::CPAN
sub memory_limit_in_mb {
return +$ENV{AWS_LAMBDA_FUNCTION_MEMORY_SIZE} // die 'memory_limit_in_mb is not found';
}
sub aws_request_id {
my $self = shift;
return $self->{aws_request_id};
}
sub log_group_name {
return $ENV{AWS_LAMBDA_LOG_GROUP_NAME} // die 'log_group_name is not found';
}
sub log_stream_name {
return $ENV{AWS_LAMBDA_LOG_STREAM_NAME} // die 'log_stream_name is not found';
}
sub identity {
return undef; # TODO
}
sub client_context {
return undef; # TODO
}
lib/AWS/Lambda/Context.pm view on Meta::CPAN
# The Amazon Resource Name (ARN) used to invoke the function.
# Indicates if the invoker specified a version number or alias.
invoked_function_arn => $context->invoked_function_arn,
# The amount of memory configured on the function.
memory_limit_in_mb => $context->memory_limit_in_mb,
# The identifier of the invocation request.
aws_request_id => $context->aws_request_id,
# The log group for the function.
log_group_name => $context->log_group_name,
# The log stream for the function instance.
log_stream_name => $context->log_stream_name,
};
return $result;
}
=head1 LICENSE
The MIT License (MIT)
Copyright (C) ICHINOSE Shogo.
( run in 1.539 second using v1.01-cache-2.11-cpan-49f99fa48dc )