Skip to content

Commit

Permalink
ci: update region denylist for lambda layers (#1171)
Browse files Browse the repository at this point in the history
Signed-off-by: Caden Marofke <[email protected]>
  • Loading branch information
marofke authored Dec 22, 2023
1 parent 9b26976 commit 01edb9f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lambda-layers/bin/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ async function publishLayerToRegion(
})
if (await isDescriptionUpdated(descriptionText, lambda, layerName)) {
try {
console.log(`Publishing to: ${region}`);
const publishResult = await lambda.publishLayerVersion({
LayerName: layerName,
Content: {
Expand Down Expand Up @@ -98,6 +99,9 @@ getRegions().then(regions => {
licenseText,
region,
runtimes,
);
).catch(e => {
console.error(`Failed publishing in ${region}, which may be due to the REGION_DENY_LIST needing updating. Error: ${e}`);
throw e;
});
}
});
8 changes: 8 additions & 0 deletions lambda-layers/lib/get-regions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@
import { SSM } from 'aws-sdk';

// These regions need to be enabled for the AWS account being used for publishing, so we skip them
// See https://docs.aws.amazon.com/accounts/latest/reference/manage-acct-regions.html
const REGION_DENY_LIST = [
'af-south-1',
'ap-east-1',
'ap-south-2',
'ap-southeast-3',
'ap-southeast-4',
'ca-west-1',
'eu-south-1',
'eu-south-2',
'eu-central-2',
'il-central-1',
'me-south-1',
'me-central-1',
];

function isValidRegion(region: string): boolean {
Expand Down

0 comments on commit 01edb9f

Please sign in to comment.