博客园  :: 首页  :: 管理

AWS-CDK-环境准备-CLI权限配置后-获取AWS-ID-信息

Posted on 2025-05-11 12:25  520_1351  阅读(12)  评论(0)    收藏  举报

使用CDK操作AWS环境,需要有CLI的权限 ,如果是EC2可以配置IAM-Role ,也可以创建AK/SK

配置完成后,可以通过如下命令,获取AWS账号的ID

获取 AWS 的ID | Run the following AWS CLI command to get the AWS account ID for your default profile:

aws sts get-caller-identity --query "Account" --output text
aws sts get-caller-identity --profile {your-profile-name} --query "Account" --output text

获取配置的Region (原理是读取的配置文件) | To use the AWS CLI to obtain your AWS Region

aws configure get region
aws configure get region --profile {your-profile-name}

 

 

 

尊重别人的劳动成果 转载请务必注明出处:https://www.cnblogs.com/5201351/p/18870677