Skip to content

v1.1.0 — AWS 连通性预检 + AWS profile 选择

Choose a tag to compare

@ddpie ddpie released this 08 Jul 12:23
· 11 commits to main since this release
98e22cd

中文

部署脚本两处增强,均向后兼容。

cdk bootstrap 前加连通性预检

  • bootstrap 之前先用带超时的 sts get-caller-identity 探一下目标区域。连不上就在几秒内明确报错,而不是像原来那样卡满 CLI 默认的 60 秒、屏幕上又没有任何输出。
  • connect 超时设 20 秒,不比它守护的后续操作更严格,免得把慢一点但其实能用的代理链路挡在门外;同时把真实的 stderr 首行透出来——连不上未必是网络问题,也可能是凭证过期或该区域没在账户里开通(opt-in)。
  • 不去动 IMDS 超时。EC2 instance role 的凭证正是从 IMDS 取的,压低它会在健康实例上误报“连不上”。本地 credential 和 EC2 instance role 两种凭证来源都兼容。

AWS profile 选择

  • 部署前解析 ~/.aws/configcredentials。配了多个 profile 时,让用户选这次部署到哪个账号;只有 default 或单一 profile 时静默沿用原来的行为。
  • 选定的 profile 存进 per-app deploy-config,重跑和 --yes 会自动沿用;显式设的 AWS_PROFILE 环境变量优先级最高。

English

Two backward-compatible enhancements to the deploy script.

Connectivity preflight before cdk bootstrap

  • A bounded sts get-caller-identity probes the region first; unreachable → a clear error in seconds instead of a silent 60s hang with no output.
  • connect timeout 20s (never stricter than the operations it guards); surfaces the real stderr first line — the cause may be expired credentials or an opt-in region, not the network.
  • IMDS timeout untouched — both local credentials and EC2 instance role work.

AWS profile selection

  • Parses ~/.aws/config + credentials; multi-profile users pick the target account, single/default setups stay silent (byte-identical to before).
  • Persisted to the per-app deploy-config and reused on redeploy / --yes; an explicit AWS_PROFILE env var wins.