Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): CLI does not use regional endpoints #9835

Merged
merged 2 commits into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/aws-cdk/lib/api/aws-auth/sdk-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ import { Mode } from '../aws-auth/credentials';
import { AwsCliCompatible } from './awscli-compatible';
import { ISDK, SDK } from './sdk';


// Some configuration that can only be achieved by setting
// environment variables.
process.env.AWS_STS_REGIONAL_ENDPOINTS = 'regional';
process.env.AWS_NODEJS_CONNECTION_REUSE_ENABLED = '1';

/**
* Options for the default SDK provider
*/
Expand Down Expand Up @@ -82,7 +88,7 @@ const CACHED_DEFAULT_CREDENTIALS = Symbol('cached_default_credentials');
*/
export class SdkProvider {
/**
* Create a new SdkProvider which gets its defaults in a way that haves like the AWS CLI does
* Create a new SdkProvider which gets its defaults in a way that behaves like the AWS CLI does
*
* The AWS SDK for JS behaves slightly differently from the AWS CLI in a number of ways; see the
* class `AwsCliCompatible` for the details.
Expand Down Expand Up @@ -302,6 +308,7 @@ function parseHttpOptions(options: SdkHttpOptions) {
debug('Using CA bundle path: %s', caBundlePath);
config.httpOptions.agent = new https.Agent({
ca: readIfPossible(caBundlePath),
keepAlive: true,
});
}

Expand Down
2 changes: 2 additions & 0 deletions packages/cdk-assets/bin/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class DefaultAwsClient implements IAws {
constructor(profile?: string) {
// Force AWS SDK to look in ~/.aws/credentials and potentially use the configured profile.
process.env.AWS_SDK_LOAD_CONFIG = '1';
process.env.AWS_STS_REGIONAL_ENDPOINTS = 'regional';
process.env.AWS_NODEJS_CONNECTION_REUSE_ENABLED = '1';
if (profile) {
process.env.AWS_PROFILE = profile;
}
Expand Down