[AWS] Lambda Python Get Current Account Id
2023-09-11 14:21:36 时间
Unlike AWS_REGION
or AWS_LAMBDA_FUNCTION_NAME
, we cannot get current account id from the environment variables. In order to to get the account id, we can use boto3
library with the following code:
import boto3
client = boto3.client("sts")
account_id = client.get_caller_identity()["Account"]
相关文章
- Python脚本扫描给定网段的MAC地址表(scapy或 python-nmap)
- Python脚本写端口扫描器(socket,python-nmap)
- Python unicode编码转中文
- Python url编码、url解码
- Python零基础入门,2分钟带你了解python
- 每天一个python小知识——如何在Python 3中转换数据类型
- 学习Python发展前景如何?
- 详解Python_Numpy库函数take_along_axis()【由索引矩阵生成新的矩阵】
- python json文本处理详解
- python format
- 基于python的密码生成器实例解析
- 由前序遍历和中序遍历构建二叉树-Python
- Python个人博客项目-1.项目分析与环境配置
- Python 教程大全之使用 python 获取唯一单词的计数
- Python 教程之如何使用 matplotlib 在 python 中绘制数学函数
- Python 学习入门(28)—— 服务器实例
- python 在已有记录规则下增加权限
- odoo13 数据库字段列名的获取 python
- Python 工具 之 Windows 上 python 虚拟环境的搭建与简单使用的相关说明
- 【Python注意事项】如何理解python中间generator functions和yield表情
- python的requests库详解
- python第二十九课——文件读写(读取读取中文字符)
- Python - 3.6 学习三