1
AWS Lambda를 사용하여 CloudWatch와 지정된 간격으로 EC2 인스턴스를 \ 해제합니다. 파이썬 2.7 런타임을 사용하여 AWS Lambda 코드를 작성하고 코드를 넣으십시오.AWS Lambda with Python 2.7 오류
import boto3
region = 'xxxxxx'
instances = ['i-xxxxxxxxxx']
def lambda_handler(event, context):
ec2 = boto3.client('ec2', region_name=region)
ec2.stop_instances(InstanceIds=instances)
print 'stopped your instances: ' + str(instances)
인라인 코드로.
{
"errorMessage": "Handler 'handler' missing on module 'index'"
}
사람의 도움을 주시면 감사하겠습니다 :하지만 내가 실행 로그에 다음과 같은 오류가 람다 기능을 수동으로 EC2 인스턴스의 정지를 테스트 트리거합니다.