Skip to content

Commit

Permalink
Add ARM layers
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli committed Oct 21, 2022
1 parent 257735e commit 04ebc5c
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 5 deletions.
18 changes: 13 additions & 5 deletions layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ const layerVersions = require('./layers.json');
* Returns the ARN for the function layer.
* @param {string} region
* @param {string} phpVersion (e.g. '8.1')
* @param {'x86'|'arm'} platform
* @returns {string} Layer ARN
*/
function functionLayerArn(region, phpVersion) {
const layerName = 'php-' + phpVersion.replace('.', '');
function functionLayerArn(region, phpVersion, platform) {
let layerName = 'php-' + phpVersion.replace('.', '');
if (platform === 'arm') {
layerName = 'arm-' + layerName;
}
const version = layerVersions[layerName][region];
return `arn:aws:lambda:${region}:534081306603:layer:${layerName}:${version}`;
}
Expand All @@ -17,10 +21,14 @@ function functionLayerArn(region, phpVersion) {
* Returns the ARN for the FPM layer.
* @param {string} region
* @param {string} phpVersion (e.g. '8.1')
* @param {'x86'|'arm'} platform
* @returns {string} Layer ARN
*/
function fpmLayerArn(region, phpVersion) {
const layerName = 'php-' + phpVersion.replace('.', '') + '-fpm';
function fpmLayerArn(region, phpVersion, platform) {
let layerName = 'php-' + phpVersion.replace('.', '') + '-fpm';
if (platform === 'arm') {
layerName = 'arm-' + layerName;
}
const version = layerVersions[layerName][region];
return `arn:aws:lambda:${region}:534081306603:layer:${layerName}:${version}`;
}
Expand All @@ -37,7 +45,7 @@ function consoleLayerArn(region) {

module.exports = {
// Expose the JSON data as a JS dependency for easier use in programmatic environments
layerVersions: layerVersions,
layerVersions,
functionLayerArn,
fpmLayerArn,
consoleLayerArn,
Expand Down
46 changes: 46 additions & 0 deletions layers.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,52 @@
"us-west-1": "2",
"us-west-2": "2"
},
"arm-php-80": {
"af-south-1": "",
"ap-east-1": "",
"ap-northeast-1": "1",
"ap-northeast-2": "1",
"ap-northeast-3": "1",
"ap-south-1": "1",
"ap-southeast-1": "1",
"ap-southeast-2": "1",
"ca-central-1": "2",
"eu-central-1": "2",
"eu-north-1": "2",
"eu-south-1": "",
"eu-west-1": "2",
"eu-west-2": "2",
"eu-west-3": "2",
"me-south-1": "",
"sa-east-1": "2",
"us-east-1": "2",
"us-east-2": "2",
"us-west-1": "2",
"us-west-2": "2"
},
"arm-php-80-fpm": {
"af-south-1": "",
"ap-east-1": "",
"ap-northeast-1": "1",
"ap-northeast-2": "1",
"ap-northeast-3": "1",
"ap-south-1": "1",
"ap-southeast-1": "1",
"ap-southeast-2": "1",
"ca-central-1": "2",
"eu-central-1": "2",
"eu-north-1": "2",
"eu-south-1": "",
"eu-west-1": "2",
"eu-west-2": "2",
"eu-west-3": "2",
"me-south-1": "",
"sa-east-1": "2",
"us-east-1": "2",
"us-east-2": "2",
"us-west-1": "2",
"us-west-2": "2"
},
"console": {
"af-south-1": "",
"ap-east-1": "",
Expand Down
2 changes: 2 additions & 0 deletions scripts/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const layerNames = [
'php-81-fpm',
'php-80',
'php-80-fpm',
'arm-php-80',
'arm-php-80-fpm',
'console',
];

Expand Down

0 comments on commit 04ebc5c

Please sign in to comment.