PutFunctionConcurrency 코드 예제
PutFunctionConcurrency 코드 예제 (PutFunctionConcurrency code examples)
AWS SDK를 사용해 Lambda 함수의 예약 동시성(reserved concurrency)을 구성하는 코드 예제를 보여줘요. 이 섹션에서는 PutFunctionConcurrency API 작업을 사용해 함수에 대한 예약 동시성을 설정하는 방법을 설명해요.
본문
PutFunctionConcurrency 작업은 Lambda 함수에 대한 예약 동시성을 설정해요. 예약 동시성은 함수가 동시에 실행할 수 있는 인스턴스의 최대 수를 제한해요.
PutFunctionConcurrency 작업을 호출하려면 lambda:PutFunctionConcurrency IAM 권한이 필요해요. 이 API는 콘솔, AWS CLI, AWS SDK를 사용해 호출할 수 있어요.
AWS CLI 예제 (AWS CLI example)
AWS CLI에서 put-function-concurrency 명령을 사용해 함수의 예약 동시성을 설정할 수 있어요.
aws lambda put-function-concurrency --function-name my-function --reserved-concurrent-executions 100
AWS SDK 예제 (AWS SDK examples)
다양한 AWS SDK에서 PutFunctionConcurrency 작업을 사용할 수 있어요. 다음은 Python Boto3 예제예요.
import boto3
client = boto3.client('lambda')
response = client.put_function_concurrency(
FunctionName='my-function',
ReservedConcurrentExecutions=100
)
print(response)
예약 동시성을 설정해 함수의 비용과 확장을 제어할 수 있어요. 예약 동시성을 0 으로 설정하면 함수에 대한 모든 호출이 제한돼요.