Skip to content

Commit

Permalink
chore: add new partitions and regions
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealAmazonKendra committed Jul 2, 2024
1 parent 84fc01f commit 6f7cf32
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 23 deletions.
43 changes: 27 additions & 16 deletions packages/aws-cdk-lib/region-info/build-tools/fact-tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ enum Partition {
UsGov = 'aws-us-gov',
UsIso = 'aws-iso',
UsIsoB = 'aws-iso-b',
UsIsoF = 'aws-iso-f',
EuIsoE = 'aws-iso-e',
}

interface Region { partition: Partition; domainSuffix: string }
Expand All @@ -88,6 +90,31 @@ export const PARTITION_MAP: { [region: string]: Region } = {
'us-gov-': { partition: Partition.UsGov, domainSuffix: 'amazonaws.com' },
'us-iso-': { partition: Partition.UsIso, domainSuffix: 'c2s.ic.gov' },
'us-isob-': { partition: Partition.UsIsoB, domainSuffix: 'sc2s.sgov.gov' },
'us-isof-': { partition: Partition.UsIsoF, domainSuffix: 'csp.hci.ic.gov' },
'eu-isoe-': { partition: Partition.EuIsoE, domainSuffix: 'cloud.adc-e.uk' },
};

export const PARTITION_SAML_SIGN_ON_URL: Partial<Record<Partition, string>> = {
[Partition.Default]: 'https://signin.aws.amazon.com/saml',
[Partition.Cn]: 'https://signin.amazonaws.cn/saml',
[Partition.UsGov]: 'https://signin.amazonaws-us-gov.com/saml',
[Partition.UsIso]: 'https://signin.c2shome.ic.gov/saml',
[Partition.UsIsoB]: 'https://signin.sc2shome.sgov.gov/saml',
};

enum Runtime {
NODE_18 = 'nodejs18.x',
NODE_20 = 'nodejs20.x'
}

export const LATEST_NODE_RUNTIME_MAP: Record<Partition, string> = {
[Partition.Default]: Runtime.NODE_20,
[Partition.Cn]: Runtime.NODE_18,
[Partition.UsGov]: Runtime.NODE_18,
[Partition.UsIso]: Runtime.NODE_18,
[Partition.UsIsoB]: Runtime.NODE_18,
[Partition.UsIsoF]: Runtime.NODE_18,
[Partition.EuIsoE]: Runtime.NODE_18,
};

// https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html#access-logging-bucket-permissions
Expand Down Expand Up @@ -3693,19 +3720,3 @@ export const ADOT_LAMBDA_LAYER_ARNS: { [key: string]: any } = {
PYTHON_SDK: ADOT_LAMBDA_LAYER_PYTHON_SDK_ARNS,
GENERIC: ADOT_LAMBDA_LAYER_GENERIC_ARNS,
};

export const PARTITION_SAML_SIGN_ON_URL: Record<Partition, string> = {
[Partition.Default]: 'https://signin.aws.amazon.com/saml',
[Partition.Cn]: 'https://signin.amazonaws.cn/saml',
[Partition.UsGov]: 'https://signin.amazonaws-us-gov.com/saml',
[Partition.UsIso]: 'https://signin.c2shome.ic.gov/saml',
[Partition.UsIsoB]: 'https://signin.sc2shome.sgov.gov/saml',
};

export const LATEST_NODE_RUNTIME_MAP: Record<Partition, string> = {
[Partition.Default]: 'nodejs20.x',
[Partition.Cn]: 'nodejs18.x',
[Partition.UsGov]: 'nodejs18.x',
[Partition.UsIso]: 'nodejs18.x',
[Partition.UsIsoB]: 'nodejs18.x',
};
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@ export async function main(): Promise<void> {

await fs.writeFile(path.resolve(__dirname, '..', 'lib', 'built-ins.generated.ts'), lines.join('\n'));

function registerFact(region: string, name: string | string[], value: string) {
const factName = typeof name === 'string' ? name : `${name[0]}(${name.slice(1).map(s => JSON.stringify(s)).join(', ')})`;
lines.push(` Fact.register({ region: ${JSON.stringify(region)}, name: FactName.${factName}, value: ${JSON.stringify(value)} });`);
function registerFact(region: string, name: string | string[], value?: string) {
if (value) {
const factName = typeof name === 'string' ? name : `${name[0]}(${name.slice(1).map(s => JSON.stringify(s)).join(', ')})`;
lines.push(` Fact.register({ region: ${JSON.stringify(region)}, name: FactName.${factName}, value: ${JSON.stringify(value)} });`);
}
}
}

Expand Down
15 changes: 11 additions & 4 deletions packages/aws-cdk-lib/region-info/lib/aws-entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,21 @@ export const AWS_REGIONS_AND_RULES: readonly (string | symbol)[] = [
RULE_CLASSIC_PARTITION_BECOMES_OPT_IN,
'ap-east-1', // Asia Pacific (Hong Kong)
'me-south-1', // Middle East (Bahrain)
'eu-south-1', // Europe (Milan)
'af-south-1', // Africa (Cape Town)
'eu-south-1', // Europe (Milan)
'us-iso-west-1', // US ISO West
'eu-south-2', // Europe (Spain)
'ap-southeast-3', // Asia Pacific (Jakarta)
'me-central-1', // Middle East (UAE)
'ap-south-2', // Asia Pacific (Hyderabad)
'eu-central-2', // Europe (Zurich)
'il-central-1', // Israel (Tel Aviv)
'eu-south-2', // Europe (Spain)
'ap-south-2', // Asia Pacific (Hyderabad)
'ap-southeast-4', // Asia Pacific (Melbourne)
'il-central-1', // Israel (Tel Aviv)
'ca-west-1', // Canada West (Calgary)
'ap-southeast-5', // Asia Pacific (Malaysia)
'ap-southeast-7', // Asia Pacific (Thailand)
'mx-central-1', // Mexico (Central)
'eu-isoe-west-1', // EU ISO-E West
];

/**
Expand Down Expand Up @@ -128,6 +133,8 @@ const PARTITION_MAP: {readonly [region: string]: Region } = {
'us-gov-': { partition: 'aws-us-gov', domainSuffix: 'amazonaws.com' },
'us-iso-': { partition: 'aws-iso', domainSuffix: 'c2s.ic.gov' },
'us-isob-': { partition: 'aws-iso-b', domainSuffix: 'sc2s.sgov.gov' },
'us-isof-': { partition: 'aws-iso-f', domainSuffix: 'csp.hci.ic.gov' },
'eu-isoe-': { partition: 'aws-iso-e', domainSuffix: 'cloud.adc-e.uk' },
};

export function partitionInformation(region: string): Region {
Expand Down

0 comments on commit 6f7cf32

Please sign in to comment.