AWS Systems Manager의 기능인 자동화를 사용해 파라미터를 검색하는 방법을 알고 싶습니다.
해결 방법
GetParameter API로 자동화 작업 aws:executeAwsApi를 사용하여 파라미터 저장소에서 파라미터 값을 검색할 수 있습니다. 이는 AWS Systems Manager의 기능입니다.
예시:
{
"description": "Automation Document Example JSON Template",
"schemaVersion": "0.3",
"assumeRole": "{{ AutomationAssumeRole }}",
"parameters": {
"ParameterName": {
"type": "String",
"description": "Enter the Name of the String Parameter to retrieve its value"
},
"AutomationAssumeRole": {
"type": "String",
"description": "(Optional) The ARN of the role that allows Automation to perform the actions on your behalf.",
"default": ""
}
},
"mainSteps": [
{
"name": "getparameter",
"action": "aws:executeAwsApi",
"inputs": {
"Service": "ssm",
"Api": "GetParameter",
"Name": "{{ ParameterName }}"
},
"outputs": [
{
"Name": "Parameters",
"Selector": "$.Parameter.Value",
"Type": "String"
}
]
}
],
"outputs": [
"getparameter.Parameters"
]
}
SecureString 파라미터를 검색하려면 WithDecryption을 사용하고 값을 true로 설정합니다.
예시:
"mainSteps": [
{
"name": "getparameter",
"action": "aws:executeAwsApi",
"inputs": {
"Service": "ssm",
"Api": "GetParameter",
"Name": "{{ ParameterName }}",
"WithDecryption": true
},
자세한 내용은 Run Command 명령을 사용한 파라미터 작업을 참고하세요.
관련 정보
AWS Systems Manager Parameter Store
데이터 요소 및 파라미터
AWS::SSM::파라미터