(aws-ec2): addS3DownloadCommand does not work in China, opt-in regions
See original GitHub issueUse Case
Currently, AWS China region need aws s3 cp --region cn-north-1
to be able to download file from s3
Proposed Solution
export interface S3DownloadOptions {
/**
* Name of the S3 bucket to download from
*/
readonly bucket: IBucket;
/**
* The key of the file to download
*/
readonly bucketKey: string;
/**
* The name of the local file.
*
* @default Linux - /tmp/bucketKey
* Windows - %TEMP%/bucketKey
*/
readonly localFile?: string;
/**
* The region to use
*/
readonly region?: string;
}
public addS3DownloadCommand(params: S3DownloadOptions): string {
const s3Path = `s3://${params.bucket.bucketName}/${params.bucketKey}`;
const localPath = ( params.localFile && params.localFile.length !== 0 ) ? params.localFile : `/tmp/${ params.bucketKey }`;
this.addCommands(
`mkdir -p $(dirname '${localPath}')`,
`aws s3 cp --region '${params.region ?? stack.region}' '${s3Path}' '${localPath}'`,
);
return localPath;
}
- 👋 I may be able to implement this feature request
- ⚠️ This feature might incur a breaking change
This is a 🚀 Feature Request
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Regions and Zones - Amazon Elastic Compute Cloud
Describes the Regions, Availability Zones, Local Zones, Outposts, and Wavelength Zones world-wide where you can host your instances.
Read more >Is there way for users in china to access my s3, ec2 and api ...
Some days they can't. We are set up in 13 different AWS regions currently, and usually recommend users in China choose either our...
Read more >@aws-cdk/aws-ec2 | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >Enabling Opt-In Regions - InsightCloudSec Docs
The screenshot below provides an example of how to enable the region in the AWS console. 1600. Enabling Opt-In Regions. Once enabled, you...
Read more >Checking if a region is enabled using the AWS API. - Cloudar
“aws ec2 describe-regions” now returns the “OptInStatus”. ... region is enabled or not (except if you're using one of the China regions).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I guess it’s only accidental that the other commands even work 😦 .
A better fix would have been to set
AWS_REGION
at the start of UserData, but that’s probably a change we can’t make anymore. Adding in the--region
parameter seems like the best solution.⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.