You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行CDK部署至AWS CI/CD账户失败,请求技术协助

问题描述

尝试将Pipeline部署至CI/CD账户时,执行命令出现凭证获取失败错误,具体错误输出如下:

npm run cdk deploy LandingPagePipelineStack -- --profile cicd


> landingpage@0.3.13 cdk
> cdk deploy LandingPagePipelineStack --profile cicd

 Failed to get credentials for "cicd" profile. Make sure to run "aws configure sso --profile cicd && aws sso login --profile cicd"

已执行 aws configure sso --profile cicd && aws sso login --profile cicd 并完成登录,当前正按AWS教程第5步操作,需协助完成Pipeline部署至CI/CD账户。

排查与解决步骤
  • 验证SSO凭证有效性
    执行 aws sts get-caller-identity --profile cicd 检查cicd profile的凭证是否能正常调用AWS服务。若报错,重新执行 aws sso login --profile cicd,确保登录流程完成后重启终端或刷新环境变量。
  • 检查AWS配置文件正确性
    打开本地AWS配置文件(路径通常为 ~/.aws/config),确认cicd profile的配置参数完整且正确,示例配置如下:
    [profile cicd]
    sso_start_url = https://your-sso-portal.awsapps.com/start
    sso_region = us-east-1
    sso_account_id = 123456789012
    sso_role_name = AdministratorAccess
    region = us-east-1
    
    若参数缺失或错误,重新执行 aws configure sso --profile cicd 重新配置。
  • 确认CDK环境初始化状态
    执行 cdk bootstrap --profile cicd 确保CI/CD账户已完成CDK环境的bootstrap操作,未初始化会导致部署时凭证验证失败。
  • 清除环境变量冲突
    检查终端是否设置了AWS_ACCESS_KEY_ID、AWS_SECRET_ACCESS_KEY等环境变量,这些会覆盖SSO profile的凭证。执行以下命令清除冲突变量后重新尝试部署:
    unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY
    

内容的提问来源于stack exchange,提问作者Sushant Somani

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.03 11:25:34