【问题标题】:Packer with AWS SSO Profile使用 AWS SSO 配置文件的打包程序
【发布时间】:2021-04-27 02:16:34
【问题描述】:

我正在尝试使用带有“配置文件”变量(无需提供静态访问密钥)的打包程序,我正在使用 aws configure sso 命令配置该变量 - 但是在尝试运行打包程序命令时出现错误:

错误:NoCredentialProviders:链中没有有效的提供者。已弃用。 有关详细消息,请参阅 aws.Config.CredentialsChainVerboseErrors

在我的打包器 variables.json 我有 "aws_profile": "sandbox" 在我的 environment.json 我有

"builders": [
        {
            "type": "amazon-ebs",
            "profile": "{{user `aws_profile`}}"

是我遗漏了什么还是无法做到这一点?

【问题讨论】:

    标签: amazon-web-services packer


    【解决方案1】:

    根据source

    
    // profile returns the AWS shared credentials profile.  If empty will read
    // environment variable "AWS_PROFILE". If that is not set profile will
    // return "default".
    func (p *SharedCredentialsProvider) profile() string {
        if p.Profile == "" {
            p.Profile = os.Getenv("AWS_PROFILE")
        }
        if p.Profile == "" {
            p.Profile = "default"
        }
    
        return p.Profile
    }
    

    类似问题Use of AWS credentials profile ignored #7427

    引用问题:

    我发现了我的问题:我的 build.json 被配置为使用特定的配置文件(“profile”:“default”),并且优先于 AWS_PROFILE。一旦我删除了这条线,一切都很好。

    如果这些是正确的,那么它可能是变量名本身。

    {
      "variables": {
        "aws_profile": "{{env `AWS_PROFILE`}}"
      },
      "builders": [{
        "type": "amazon-ebs",
        "region": "eu-central-1",
        "profile": "{{ user `aws_profile`}}"
    [...]
    

    【讨论】:

    • 谢谢,但不幸的是,这似乎不起作用。使用AWS CONFIGURE SSO 似乎对 .aws\config 文件有完全不同的影响...不会显示为带有访问密钥等的正常配置:``` [profile sandbox] sso_start_url = https://[redacted ].awsapps.com/start# sso_region = eu-west-2 sso_account_id = [redacted] sso_role_name = [redacted] region = eu-west-2 输出 = json ```
    猜你喜欢
    • 2021-06-20
    • 1970-01-01
    • 2021-01-11
    • 1970-01-01
    • 1970-01-01
    • 2020-04-19
    • 2016-12-01
    • 2016-04-14
    • 2011-04-26
    相关资源
    最近更新 更多