Synthetics 런타임 버전 - Amazon CloudWatch

Synthetics 런타임 버전

canary를 생성하거나 업데이트하는 경우 canary에 대한 Synthetics 런타임 버전을 선택합니다. Synthetics 런타임은 스크립트 핸들러를 호출하는 Synthetics 코드와 Lambda 번들 종속성 계층의 조합입니다.

CloudWatch Synthetics는 현재 스크립트 및 Puppeteer 프레임워크에 Node.js를 사용하는 런타임과 스크립팅에 Python을 사용하고 프레임워크에 Selenium Webdriver를 사용하는 런타임을 지원합니다.

최신 기능과 Synthetics 라이브러리 업데이트를 사용하도록 canary에 항상 최신 런타임 버전을 사용하는 것이 좋습니다.

canary를 생성할 때 생성되는 계층 중 하나는 앞에 Synthetics가 추가된 Synthetics 계층입니다. 이 계층은 Synthetics 서비스 계정이 소유하며 런타임 코드를 포함합니다.

참고

새 버전의 Synthetics 런타임을 사용하도록 canary를 업그레이드할 때마다 canary에서 사용하는 모든 Synthetics 라이브러리 함수도 Synthetics 런타임이 지원하는 것과 동일한 버전의 NodeJS로 자동 업그레이드됩니다.

CloudWatch Synthetics 런타임 지원 정책

Synthetics 런타임 버전에는 유지 관리 및 보안 업데이트가 적용됩니다. 런타임 버전의 구성 요소가 더 이상 지원되지 않는 경우 해당 Synthetics 런타임 버전은 더 이상 사용되지 않습니다.

사용 중단된 런타임 버전을 사용하여 canary를 생성할 수 없습니다. 사용 중단된 런타임을 사용하는 canary는 계속 실행됩니다. 이러한 canary를 중지, 시작 및 삭제할 수 있습니다. 지원되는 런타임 버전을 사용하도록 canary를 업데이트함으로써 사용 중지된 런타임 버전을 사용하는 기존 canary를 업데이트할 수 있습니다.

CloudWatch Synthetics는 향후 60일 이내에 사용 중지될 예정인 런타임을 사용하는 canary가 있는 경우 이를 이메일로 알려줍니다. 최신 릴리스에 포함된 새로운 기능, 보안, 성능 향상의 이점을 활용하려면 canary를 지원되는 런타임 버전으로 마이그레이션하는 것이 좋습니다.

canary를 새 런타임 버전으로 업데이트하려면 어떻게 해야 하나요?

CloudWatch 콘솔, AWS CloudFormation, AWS CLI 또는 AWS SDK를 사용하여 canary의 런타임 버전을 업데이트할 수 있습니다. CloudWatch 콘솔을 사용할 경우 한 번에 최대 5개의 canary를 업데이트할 수 있는데, canary 목록 페이지에서 canary를 선택한 다음, [작업(Actions)], [런타임 업데이트(Update Runtime)]를 선택하면 됩니다.

먼저, CloudWatch 콘솔을 사용하여 canary를 복제하고 해당 런타임 버전을 업데이트하여 업그레이드를 확인할 수 있습니다. 이렇게 하면 원래 canary의 복제인 또 다른 canary가 생성됩니다. 새 런타임 버전의 canary를 확인한 후에는 원래 canary의 런타임 버전을 업데이트하고 복제 canary를 삭제할 수 있습니다.

또한 업그레이드 스크립트를 사용하여 여러 canary를 업데이트할 수도 있습니다. 자세한 내용은 canary 런타임 업그레이드 스크립트 단원을 참조하십시오.

canary를 업그레이드했는데 canary가 실패한 경우 실패한 canary 문제 해결 단원을 참조하세요.

런타임 사용 중단 날짜

런타임 버전 사용 중단 날짜

syn-nodejs-puppeteer-6.1

2024년 3월 8일

syn-nodejs-puppeteer-6.0

2024년 3월 8일

syn-nodejs-puppeteer-5.1

2024년 3월 8일

syn-nodejs-puppeteer-5.0

2024년 3월 8일

syn-nodejs-puppeteer-4.0

2024년 3월 8일

syn-nodejs-puppeteer-3.9

2024년 1월 8일

syn-nodejs-puppeteer-3.8

2024년 1월 8일

syn-python-selenium-2.0

2024년 3월 8일

syn-python-selenium-1.3

2024년 3월 8일

syn-python-selenium-1.2

2024년 3월 8일

syn-python-selenium-1.1

2024년 3월 8일

syn-python-selenium-1.0

2024년 3월 8일

syn-nodejs-puppeteer-3.7

2024년 1월 8일

syn-nodejs-puppeteer-3.6

2024년 1월 8일

syn-nodejs-puppeteer-3.5

2024년 1월 8일

syn-nodejs-puppeteer-3.4

2022년 11월 13일

syn-nodejs-puppeteer-3.3

2022년 11월 13일

syn-nodejs-puppeteer-3.2

2022년 11월 13일

syn-nodejs-puppeteer-3.1

2022년 11월 13일

syn-nodejs-puppeteer-3.0

2022년 11월 13일

syn-nodejs-2.2

2021년 5월 28일

syn-nodejs-2.1

2021년 5월 28일

syn-nodejs-2.0

2021년 5월 28일

syn-nodejs-2.0-beta

2021년 2월 8일

syn-1.0

2021년 5월 28일

canary 런타임 업그레이드 스크립트

canary 스크립트를 지원되는 런타임 버전으로 업그레이드하려면 다음 스크립트를 사용합니다.

const AWS = require('aws-sdk'); // You need to configure your AWS credentials and Region. // https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/setting-credentials-node.html // https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/setting-region.html const synthetics = new AWS.Synthetics(); const DEFAULT_OPTIONS = { /** * The number of canaries to upgrade during a single run of this script. */ count: 10, /** * No canaries are upgraded unless force is specified. */ force: false }; /** * The number of milliseconds to sleep between GetCanary calls when * verifying that an update succeeded. */ const SLEEP_TIME = 5000; (async () => { try { const options = getOptions(); const versions = await getRuntimeVersions(); const canaries = await getAllCanaries(); const upgrades = canaries .filter(canary => !versions.isLatestVersion(canary.RuntimeVersion)) .map(canary => { return { Name: canary.Name, FromVersion: canary.RuntimeVersion, ToVersion: versions.getLatestVersion(canary.RuntimeVersion) }; }); if (options.force) { const promises = []; for (const upgrade of upgrades.slice(0, options.count)) { const promise = upgradeCanary(upgrade); promises.push(promise); // Sleep for 100 milliseconds to avoid throttling. await usleep(100); } const succeeded = []; const failed = []; for (let i = 0; i < upgrades.slice(0, options.count).length; i++) { const upgrade = upgrades[i]; const promise = promises[i]; try { await promise; console.log(`The update of ${upgrade.Name} succeeded.`); succeeded.push(upgrade.Name); } catch (e) { console.log(`The update of ${upgrade.Name} failed with error: ${e}`); failed.push({ Name: upgrade.Name, Reason: e }); } } if (succeeded.length) { console.group('The following canaries were upgraded successfully.'); for (const name of succeeded) { console.log(name); } console.groupEnd() } else { console.log('No canaries were upgraded successfully.'); } if (failed.length) { console.group('The following canaries were not upgraded successfully.'); for (const failure of failed) { console.log('\x1b[31m', `${failure.Name}: ${failure.Reason}`, '\x1b[0m'); } console.groupEnd(); } } else { console.log('Run with --force [--count <count>] to perform the first <count> upgrades shown. The default value of <count> is 10.') console.table(upgrades); } } catch (e) { console.error(e); } })(); function getOptions() { const force = getFlag('--force', DEFAULT_OPTIONS.force); const count = getOption('--count', DEFAULT_OPTIONS.count); return { force, count }; function getFlag(key, defaultValue) { return process.argv.includes(key) || defaultValue; } function getOption(key, defaultValue) { const index = process.argv.indexOf(key); if (index < 0) { return defaultValue; } const value = process.argv[index + 1]; if (typeof value === 'undefined' || value.startsWith('-')) { throw `The ${key} option requires a value.`; } return value; } } function getAllCanaries() { return new Promise((resolve, reject) => { const canaries = []; synthetics.describeCanaries().eachPage((err, data) => { if (err) { reject(err); } else { if (data === null) { resolve(canaries); } else { canaries.push(...data.Canaries); } } }); }); } function getRuntimeVersions() { return new Promise((resolve, reject) => { const jsVersions = []; const pythonVersions = []; synthetics.describeRuntimeVersions().eachPage((err, data) => { if (err) { reject(err); } else { if (data === null) { jsVersions.sort((a, b) => a.ReleaseDate - b.ReleaseDate); pythonVersions.sort((a, b) => a.ReleaseDate - b.ReleaseDate); resolve({ isLatestVersion(version) { const latest = this.getLatestVersion(version); return latest === version; }, getLatestVersion(version) { if (jsVersions.some(v => v.VersionName === version)) { return jsVersions[jsVersions.length - 1].VersionName; } else if (pythonVersions.some(v => v.VersionName === version)) { return pythonVersions[pythonVersions.length - 1].VersionName; } else { throw Error(`Unknown version ${version}`); } } }); } else { for (const version of data.RuntimeVersions) { if (version.VersionName === 'syn-1.0') { jsVersions.push(version); } else if (version.VersionName.startsWith('syn-nodejs-2.')) { jsVersions.push(version); } else if (version.VersionName.startsWith('syn-nodejs-puppeteer-')) { jsVersions.push(version); } else if (version.VersionName.startsWith('syn-python-selenium-')) { pythonVersions.push(version); } else { throw Error(`Unknown version ${version.VersionName}`); } } } } }); }); } async function upgradeCanary(upgrade) { console.log(`Upgrading canary ${upgrade.Name} from ${upgrade.FromVersion} to ${upgrade.ToVersion}`); await synthetics.updateCanary({ Name: upgrade.Name, RuntimeVersion: upgrade.ToVersion }).promise(); while (true) { await usleep(SLEEP_TIME); console.log(`Getting the state of canary ${upgrade.Name}`); const response = await synthetics.getCanary({ Name: upgrade.Name }).promise(); const state = response.Canary.Status.State; console.log(`The state of canary ${upgrade.Name} is ${state}`); if (state === 'ERROR' || response.Canary.Status.StateReason) { throw response.Canary.Status.StateReason; } if (state !== 'UPDATING') { return; } } } function usleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }