Skip to content

Need to perform AWS calls for account XXX, but no credentials have been configured but they are #20935

@jedrekdomanski

Description

@jedrekdomanski

Describe the bug

I have aws CLI configured, I have ~/.aws/config

[jedrek]
region = eu-central-1

and ~/.aws/credentials

[jedrek]
aws_access_key_id = XXXXXXXX
aws_secret_access_key = XXXXXX

Configured my Stack for my account and region

const app = new cdk.App();
new Ec2NatInstanceStack(app, 'Ec2NatInstanceStack', {
  env: { region: 'eu-central-1', account: 'XXXXXXXXXXX' }
});

But cdk synth still raises an error Need to perform AWS calls for account XXX, but no credentials have been configured

import * as cdk from '@aws-cdk/core';
import { Construct } from 'constructs';
import * as ec2 from '@aws-cdk/aws-ec2';

export class Ec2NatInstanceStack extends cdk.Stack {
  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    //===========================================================
    // NAT Instance
    //===========================================================
    const natGatewayProvider = ec2.NatProvider.instance({
      instanceType: new ec2.InstanceType('t3.small'),
    });

    //===========================================================
    // VPC
    //===========================================================
    const vpc = new ec2.Vpc(this, 'MyVpc', {
      natGatewayProvider,
      natGateways: 1,
    });
  }
}

Expected Behavior

cdk-synth works fine

Current Behavior

Need to perform AWS calls for account XXX, but no credentials have been configured

Reproduction Steps

Create Stack as above and try to cdk synth

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.29.1 (build c42e961)

Framework Version

No response

Node.js Version

v18.4.0

OS

MacOS 12.3.1

Language

Typescript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-ec2Related to Amazon Elastic Compute Cloudclosed-for-stalenessThis issue was automatically closed because it hadn't received any attention in a while.guidanceQuestion that needs advice or information.response-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions