篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 获取存储在EC2 Systems Manager中的Secure String参数相关的知识,希望对你有一定的参考价值。
def getParameter(param_name):
"""
This function reads a secure parameter from AWS' SSM service.
The request must be passed a valid parameter name, as well as
temporary credentials which can be used to access the parameter.
The parameter's value is returned.
"""
# Create the SSM Client
ssm = boto3.client('ssm',
region_name='us-east-2'
)
# Get the requested parameter
response = ssm.get_parameters(
Names=[
param_name,
],
WithDecryption=True
)
# Store the credentials in a variable
credentials = response['Parameters'][0]['Value']
return credentials
以上是关于python 获取存储在EC2 Systems Manager中的Secure String参数的主要内容,如果未能解决你的问题,请参考以下文章