Skip to content

Instantly share code, notes, and snippets.

@mhart
Last active February 13, 2020 18:31
Show Gist options
  • Save mhart/0a830d672d1c7d7b278634b82a9672e5 to your computer and use it in GitHub Desktop.
Save mhart/0a830d672d1c7d7b278634b82a9672e5 to your computer and use it in GitHub Desktop.
AWS internal error creating a 200MiB Lambda Layer
# Try to create a 200MiB layer
head -c 209715200 /dev/random > file.dat
rm -f layer.zip && zip layer.zip file.dat
aws s3 cp layer.zip s3://my-bucket/my-key
aws lambda publish-layer-version --cli-connect-timeout 0 --layer-name large-200MiB-dep --content S3Bucket=my-bucket,S3Key=my-key
# Results in:
# An error occurred (ServiceException) when calling the PublishLayerVersion operation (reached max retries: 2): An error occurred and the request cannot be processed.
# One byte less and it works (`aws lambda publish-layer-version` takes about 60 secs)
head -c 209715199 /dev/random > file.dat
rm -f layer.zip && zip layer.zip file.dat
aws s3 cp layer.zip s3://my-bucket/my-key
aws lambda publish-layer-version --cli-connect-timeout 0 --layer-name large-199MiB-dep --content S3Bucket=my-bucket,S3Key=my-key
# Results in:
{
"Content": {
"Location": ...
"CodeSha256": ...
"CodeSize": 209749295
},
"LayerArn": ...
"LayerVersionArn": ...
"Description": ...
"CreatedDate": ...
"Version": 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment