2

저는 다양한 프로젝트에서 cfn-hup을 사용했으며 cfn-hup에 대해서는 AWS documentation을 따랐습니다. 해당 페이지에 설명 된대로 나열된 다음 트리거 유형이있다 :Elastic Beanstalk에서 cfn-hup "on.demand"트리거

  • post.update
  • 내가 큰 성공이를 사용했습니다

post.remove post.add. 최근에 Elastic Beanstalk CloudFormation 템플릿을 학습 목적으로 검토했습니다. Elastic Beanstalk은 CloudFormation을 사용하여 리소스를 프로비저닝하고 부트 스트랩합니다. 당신이 볼 수 있듯이, 그들이 "on.command"트리거 유형이

"\/etc\/cfn\/hooks.d\/aws-eb-command-handler.conf":{ 
    "content":{ 
    "Fn::Join":[ 
     "", 
     [ 
     "[aws-eb-command-handler]", 
     "\n", 
     "triggers=on.command", 
     "\n", 
     "path=ElasticBeanstalkCommand-", 
     "AWSEBAutoScalingGroup", 
     "\n", 
     "action=commandWrapper.py", 
     "\n" 
     ] 
    ] 
    } 
}, 

: 그들은 CFN - HUP를 사용하지만, 자신의 구성 파일에 이상한 트리거 유형이있다. 어쩌면 내가 장님이지만 어디서나 문서화 된 것을 찾을 수는 없습니다. 이것은 Elastic Beanstalk 만 사용할 수있는 특수 내부 트리거 유형입니까? 아니면 아직 또 다른 문서화되지 않은 기능입니까? 그렇다면 어떻게됩니까?

답변

1

이 훅 유형은 실제로 문서화되지 않은 유형입니다.

on.command은 cfn-hup 명령을 SQS 대기열에 묶는 CloudFormation의 방법입니다.

는 메인 섹션에서 SQS 큐를 구성 사용하려면 :

[main] 
sqs_url=https://sqs.eu-west-1.amazonaws.com/XXXXXXXX/cfn-hook-trigger 

을 다음 메시지에 해당 대기열에, 명령은 인스턴스에서 실행됩니다. 메시지 포맷은 다음과 같다 :

{ 
"InvocationId": "unique", 
"DispatcherId": "some value, participating in message and leader elections", 
"Expiration": "1433617216000", //timestamp 
"CommandName": "cfn-auto-reloader-hook", //or any other hook name 
"ResultQueue": "https://eu-west-1.queue.amazonaws.com/...", // mandatory if hook.send_result was 
initialized 
"Data": null, //will populate ENV[CMD_DATA] env var; optional 
"EventHandle": null //will populate ENV[EVENT_HANDLE] env var; optional 
} 

경우 send_result = TRUE 선택된 훅 후 지정된 ResultQueue는의 실행 결과를 덤프하는 데 사용되는 메시지 포맷은 다음과 같다 :.

{ 
"DispatcherId" : "copied from the inbound message", 
"InvocationId" : "copied from the inbound message", 
"CommandName" : "copied from the inbound message", 
"Status" : "FAILURE" | "SUCCESS", 
"ListenerId" : "FQDN or AWS instance id if applicable", 
"Data": "STDOUT", // data > 1Kb is treated as FAILURE 
"Message": "STDERR, if $? != 0" //or first 100 bytes of STDOUT if it was > 1Kb 
} 

여기 정보는 python sources (2015 년 6 월 기준)에서 채취했습니다.

실제로 테스트하지 않았습니다.

또한 문서화되지 않았기 때문에 AWS가 동작을 변경했을 수 있습니다.

관련 문제