

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# AWS::Serverless::WebFunction
<a name="sam-resource-webfunction"></a>

 관리형 엔드포인트를 통해 HTTP 요청을 처리하는 AWS Lambda 웹 함수를 생성합니다. 호출 및 이벤트에 대한 응답으로 실행되는 Lambda 이벤트 함수와 달리 Web Function은 웹 서버를 실행하고 HTTP 요청을 직접 수신합니다. 단일에서는 웹 함수, 코드 및 구성이 포함된 변경 불가능한 개정, 트래픽을 하나 이상의 개정으로 라우팅하는 엔드포인트를 `AWS::Serverless::WebFunction` AWS SAM 생성합니다.

**참고**  
에 배포하면가 AWS SAM 리소스를 리소스로 AWS CloudFormation AWS SAM CloudFormation 변환합니다. 자세한 내용은 [에 대해 생성된 CloudFormation 리소스 AWS SAM](sam-specification-generated-resources.md) 섹션을 참조하세요.

**중요**  
함수 코드는 `AWS_LAMBDA_HTTP_ENDPOINT` 환경 변수의 호스트 및 포트에서 수신 대기하는 HTTP 서버를 실행해야 합니다. 런타임은를 설정하지 않습니다`PORT`. 기본적으로 런타임은 배포 패키지의 루트`index.js`에서 실행됩니다. [EntryPoint](#sam-webfunction-entrypoint)를 사용하여 다른 파일을 실행합니다.

**중요**  
배포 패키지를 보관하는 Amazon S3 버킷은 다음 요구 사항을 충족해야 합니다.  
버전 관리가 활성화되었습니다.
버킷 정책은 `lambda.amazonaws.com` `s3:GetObject` 및 `s3:GetObjectVersion` 권한을 부여합니다. 예를 들어와 같이 함수의 개정과 일치하는의 `ArnLike` 조건으로 정책의 범위를 `aws:SourceArn` 지정하는 것이 좋습니다`arn:aws:lambda:{{us-east-1}}:{{111122223333}}:web-function/{{my-function}}/revision/*`.
객체가 SSE-KMS로 암호화된 경우 키 정책에서를 호출`lambda.amazonaws.com`하도록 허용하는 고객 관리형 키를 사용합니다`kms:Decrypt`. Amazon S3(`aws/s3`)의 AWS 관리형 키는 키 정책을 변경할 수 없으므로 지원되지 않습니다.
버킷 정책의 예는 *AWS Lambda 개발자 안내서*의 [Lambda에 대한 버킷 정책을](https://docs.aws.amazon.com/lambda/latest/dg/web-functions-code-s3.html#web-functions-code-s3-bucket-policy) 참조하세요.  
`CodeUri`는 Amazon S3에서 객체를 참조해야 합니다. `sam build` 및 `sam package` 명령은이 리소스의 로컬 경로를 지원하지 않습니다.

## 구문
<a name="sam-resource-webfunction-syntax"></a>

 AWS Serverless Application Model (AWS SAM) 템플릿에서이 개체를 선언하려면 다음 구문을 사용합니다.

### YAML
<a name="sam-resource-webfunction-syntax.yaml"></a>

```
Type: AWS::Serverless::WebFunction
Properties:
  [AuthType](#sam-webfunction-authtype): {{String}}
  [AutoDeploymentMode](#sam-webfunction-autodeploymentmode): {{String}}
  [CodeUri](#sam-webfunction-codeuri): {{String | CodeUri}}
  [EgressNetworkConnectorArn](#sam-webfunction-egressnetworkconnectorarn): {{String}}
  [EndpointDescription](#sam-webfunction-endpointdescription): {{String}}
  [EndpointName](#sam-webfunction-endpointname): {{String}}
  [EndpointType](#sam-webfunction-endpointtype): {{String}}
  [EntryPoint](#sam-webfunction-entrypoint): {{String}}
  [EnvironmentVariables](#sam-webfunction-environmentvariables): {{Map}}
  [ExecutionRoleArn](#sam-webfunction-executionrolearn): {{String}}
  [FunctionName](#sam-webfunction-functionname): {{String}}
  [InlineCode](#sam-webfunction-inlinecode): {{String}}
  [KmsKeyArn](#sam-webfunction-kmskeyarn): {{String}}
  [LoggingConfig](#sam-webfunction-loggingconfig): {{Map}}
  [MaxConcurrencyPerEnvironment](#sam-webfunction-maxconcurrencyperenvironment): {{Integer}}
  [ReplicaRegions](#sam-webfunction-replicaregions): {{List | ReplicaRegions}}
  [RevisionDescription](#sam-webfunction-revisiondescription): {{String}}
  [RevisionWeights](#sam-webfunction-revisionweights): {{RevisionWeights}}
  [Runtime](#sam-webfunction-runtime): {{String}}
  [ScalingConfig](#sam-webfunction-scalingconfig): {{Map}}
  [Tags](#sam-webfunction-tags): {{Map}}
  [ThrottleConfig](#sam-webfunction-throttleconfig): {{Map}}
  [Timeout](#sam-webfunction-timeout): {{Integer}}
```

## 속성
<a name="sam-resource-webfunction-properties"></a>

 `AuthType`   <a name="sam-webfunction-authtype"></a>
엔드포인트가 요청을 승인하는 방법.  
+ `IamAuth`: Lambda는 서명 버전 4 및 IAM을 사용하여 요청을 승인합니다. 호출자는 함수에 대한 리소스 기반 정책을 통해 부여된 `lambda:InvokeWebFunctionEndpoint` 권한이 필요합니다.
+ `ApplicationManaged`: 엔드포인트가 퍼블릭입니다. 함수는 모든 요청 자체를 승인해야 합니다.
*유효한 값*: `IamAuth`, `ApplicationManaged`   
*유형:* 문자열  
*필수 항목 여부:* 예  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunctionEndpoint` 리소스의 `[AuthType](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-lambda-webfunctionendpoint.html#cfn-lambda-webfunctionendpoint-authtype)` 속성으로 직접 전달됩니다.

 `AutoDeploymentMode`   <a name="sam-webfunction-autodeploymentmode"></a>
엔드포인트가 개정 간에 트래픽을 라우팅하는 방법.  
+ `LatestRevision`:는이 배포가 생성하는 개정으로 트래픽의 100%를 전송합니다.
+ `Disabled`: [RevisionWeights](#sam-webfunction-revisionweights)에 따라 트래픽을 라우팅합니다.
사용할 수 있는 값과 `RevisionWeights`가 필요한지 여부는 [EndpointType](#sam-webfunction-endpointtype)에 따라 다릅니다.  
+ `HomeRegion`: 두 값 중 하나를 사용합니다. 에서는 `Disabled``RevisionWeights`가 필요합니다.
+ `MultiRegion` 또는 `PerRegion`:를 사용합니다`Disabled`. 를 생략하면 엔드포인트`RevisionWeights`는 트래픽의 100%를 동일한 스택에서 생성된 개정으로 라우팅하므로 단일 배포에서 엔드포인트를 생성할 수 있습니다. 트래픽은 이후 배포에서 생성되는 개정으로 이동하지 않습니다.
가 템플릿을 AWS SAM 변환할 때 값이 확인되어야 합니다. 파라미터`Ref`에 대한가 지원됩니다. 다른 내장 함수는 지원되지 않습니다.  
*유효한 값*: `LatestRevision`, `Disabled`   
*유형:* 문자열  
*필수 항목 여부*: 아니요  
*기본값*: `LatestRevision`  
*CloudFormation 호환성*:이 속성은에 고유 AWS SAM 하며 CloudFormation 동등한 속성이 없습니다.

 `CodeUri`   <a name="sam-webfunction-codeuri"></a>
배포 패키지의 Amazon S3 위치입니다. `Bucket`, `Key`및 선택적 `Version` 키를 사용하여 `s3://{{bucket}}/{{key}}` URI 또는 객체를 지정합니다. 버킷 요구 사항은이 페이지 상단의 참고 사항을 참조하세요.  
*유형*: 문자열 \| [CodeUri](sam-property-webfunction-codeuri.md)  
*필수 항목 여부:* 예  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunctionRevision` 리소스의 `[BuildConfig.CodeConfig.S3Object](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-lambda-webfunctionrevision-s3object.html)` 속성`Key`과 유사합니다.는 `s3://` URI를 `Bucket`, 및 로 AWS SAM 변환합니다`VersionId`.

 `EgressNetworkConnectorArn`   <a name="sam-webfunction-egressnetworkconnectorarn"></a>
VPC를 통해 함수의 아웃바운드 트래픽을 라우팅하는 네트워크 커넥터의 버전 적격 ARN입니다. ARN은와 같은 버전 번호로 끝나야 합니다`arn:aws:lambda:us-east-1:123456789012:network-connector:my-connector:1`. 동일한 템플릿에서 커넥터의 최신 버전을 사용하려면를 지정합니다`!GetAtt {{MyConnector}}.LatestVersionArn`. 커넥터의 [ComputeTypes](sam-resource-networkconnector.md#sam-networkconnector-computetypes)는 여야 합니다`WebFunction`.  
리터럴 문자열을 지정하는 경우는 해당 문자열이 버전 검증 네트워크 커넥터 ARN인지 AWS SAM 확인합니다. 내장 함수는 서비스를 통해 전달되고 검증됩니다. 이 값을 변경하면 새 개정이 생성됩니다.  
*유형:* 문자열  
*필수 항목 여부:* 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunctionRevision` 리소스의 `[ServiceConfig.EgressNetworkConnectorArn](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-lambda-webfunctionrevision-serviceconfig.html)` 속성으로 직접 전달됩니다.

 `EndpointDescription`   <a name="sam-webfunction-endpointdescription"></a>
엔드포인트에 대한 설명입니다.  
*유형:* 문자열  
*필수 항목 여부:* 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunctionEndpoint` 리소스의 `[Description](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-lambda-webfunctionendpoint.html#cfn-lambda-webfunctionendpoint-description)` 속성으로 직접 전달됩니다.

 `EndpointName`   <a name="sam-webfunction-endpointname"></a>
엔드포인트의 이름입니다. 이름을 변경하면 엔드포인트가 바뀝니다. 를 변경하면 엔드포인트`EndpointType`도 대체되므로 `EndpointName` 동시에를 변경합니다.는 새 이름 없이 사용자 지정 이름의 리소스를 대체할 수 CloudFormation 없습니다.  
*유형:* 문자열  
*필수 항목 여부*: 아니요  
*기본값*: `prod`  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunctionEndpoint` 리소스의 `[EndpointName](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-lambda-webfunctionendpoint.html#cfn-lambda-webfunctionendpoint-endpointname)` 속성으로 직접 전달됩니다.

 `EndpointType`   <a name="sam-webfunction-endpointtype"></a>
엔드포인트가 트래픽을 처리하는 위치입니다.  
+ `HomeRegion`: 스택의 리전에서를 제공합니다.
+ `MultiRegion`: 함수를 [ReplicaRegions](#sam-webfunction-replicaregions)의 리전으로 복제하고 각 요청을 가장 가까운 리전으로 라우팅합니다.
+ `PerRegion`:는 각 복제본 리전에 별도의 엔드포인트를 노출합니다.
`MultiRegion` 및 에는가 `PerRegion` 필요합니다`AutoDeploymentMode: Disabled`.  
*유효한 값*: `HomeRegion`, `MultiRegion`, `PerRegion`   
*유형:* 문자열  
*필수 항목 여부*: 아니요  
*기본값*: `HomeRegion`  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunctionEndpoint` 리소스의 `[EndpointType](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-lambda-webfunctionendpoint.html#cfn-lambda-webfunctionendpoint-endpointtype)` 속성으로 직접 전달됩니다.

 `EntryPoint`   <a name="sam-webfunction-entrypoint"></a>
배포 패키지의 루트를 기준으로 런타임이 실행하는 파일입니다.는 이를 예약된 `AWS_LAMBDA_NODEJS_ENTRYPOINT` 환경 변수의 런타임으로 AWS SAM 전달합니다.  
`EnvironmentVariables`가 내장 함수인 경우이 속성을 사용할 수 없습니다.  
*유형:* 문자열  
*필수 항목 여부*: 아니요  
*기본값*: `index.js`  
*CloudFormation 호환성*:이 속성은에 고유 AWS SAM 하며 CloudFormation 동등한 속성이 없습니다.

 `EnvironmentVariables`   <a name="sam-webfunction-environmentvariables"></a>
개정에 대한 환경 변수로 설정할 키-값 페어입니다.  
+ 키는 문자로 시작해야 하며 문자, 숫자 및 밑줄만 포함해야 합니다.
+ 값은 비어 있지 않아야 하며 최대 4,096자여야 합니다.
+ AWS SAM 는 숫자와 부울 값을 문자열로 변환합니다.
*유형*: 맵  
*필수 항목 여부:* 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunctionRevision` 리소스의 `[ServiceConfig.EnvironmentVariables](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-lambda-webfunctionrevision-serviceconfig.html#cfn-lambda-webfunctionrevision-serviceconfig-environmentvariables)` 속성으로 직접 전달됩니다.

 `ExecutionRoleArn`   <a name="sam-webfunction-executionrolearn"></a>
함수가 실행될 때 수임하는 IAM 역할의 ARN입니다. 역할을 지정하지 않으면는 `AWSLambdaBasicExecutionRole` 관리형 정책과 논리적 ID가 인 역할을 AWS SAM 생성합니다`{{<resource-logical-id>}}Role`.  
*유형:* 문자열  
*필수 항목 여부:* 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunctionRevision` 리소스의 `[ServiceConfig.ExecutionRoleArn](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-lambda-webfunctionrevision-serviceconfig.html#cfn-lambda-webfunctionrevision-serviceconfig-executionrolearn)` 속성으로 직접 전달됩니다.

 `FunctionName`   <a name="sam-webfunction-functionname"></a>
함수의 이름입니다. 함수 이름은 모든 리전의 계정 내에서 고유해야 합니다. 이름을 지정하지 않으면 논리적 ID와 스택 ID에서 최대 64자까지 이름을 AWS SAM 생성합니다. 이름을 변경하면 함수, 개정 및 엔드포인트가 대체됩니다.  
*유형:* 문자열  
*필수 항목 여부:* 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunction`, `AWS::Lambda::WebFunctionRevision`및 `AWS::Lambda::WebFunctionEndpoint` 리소스의 `[FunctionName](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-lambda-webfunction.html#cfn-lambda-webfunction-functionname)` 속성으로 직접 전달됩니다.

 `InlineCode`   <a name="sam-webfunction-inlinecode"></a>
`AWS::Serverless::WebFunction`는 지원되지 않습니다. [CodeUri](#sam-webfunction-codeuri)를 사용합니다.  
*유형:* 문자열  
*필수 항목 여부:* 아니요  
*CloudFormation 호환성*:이 속성은에 고유 AWS SAM 하며 CloudFormation 동등한 속성이 없습니다.

 `KmsKeyArn`   <a name="sam-webfunction-kmskeyarn"></a>
개정의 환경 변수를 암호화하는 데 사용되는 AWS KMS 키의 ARN입니다.  
*유형:* 문자열  
*필수 항목 여부:* 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunctionRevision` 리소스의 `[KmsKeyArn](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-lambda-webfunctionrevision.html#cfn-lambda-webfunctionrevision-kmskeyarn)` 속성으로 직접 전달됩니다.

 `LoggingConfig`   <a name="sam-webfunction-loggingconfig"></a>
로그 그룹 및 로그 수준과 같은 개정의 로깅 구성입니다.  
*유형*: 맵  
*필수 항목 여부:* 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunctionRevision` 리소스의 `[ServiceConfig.TelemetryConfig.LoggingConfig](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-lambda-webfunctionrevision-telemetryconfig.html#cfn-lambda-webfunctionrevision-telemetryconfig-loggingconfig)` 속성으로 직접 전달됩니다.

 `MaxConcurrencyPerEnvironment`   <a name="sam-webfunction-maxconcurrencyperenvironment"></a>
각 실행 환경에서 처리하는 최대 동시 요청 수입니다.  
*유형*: 정수  
*필수 항목 여부:* 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunctionRevision` 리소스의 `[ServiceConfig.MaxConcurrencyPerEnvironment](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-lambda-webfunctionrevision-serviceconfig.html#cfn-lambda-webfunctionrevision-serviceconfig-maxconcurrencyperenvironment)` 속성으로 직접 전달됩니다.

 `ReplicaRegions`   <a name="sam-webfunction-replicaregions"></a>
함수를 복제할 리전입니다. `MultiRegion` 및 `PerRegion` 엔드포인트와 함께이 속성을 사용합니다. 리전 코드 및 리전 그룹 목록 또는 `IncludeRegions` 및 선택 사항인가 있는 객체를 지정합니다`ExcludeRegions`.  
*유형*: 목록 \| [ReplicaRegions](sam-property-webfunction-replicaregions.md)  
*필수 항목 여부:* 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunctionEndpoint` resource. AWS SAM expands 리전 그룹의 `[Regions](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-lambda-webfunctionendpoint.html#cfn-lambda-webfunctionendpoint-regions)` 속성과 유사하며 리전 목록을 생성하는 `ExcludeRegions` 데 적용됩니다.

 `RevisionDescription`   <a name="sam-webfunction-revisiondescription"></a>
이 배포가 생성하는 개정에 대한 설명입니다.  
*유형:* 문자열  
*필수 항목 여부:* 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunctionRevision` 리소스의 `[Description](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-lambda-webfunctionrevision.html#cfn-lambda-webfunctionrevision-description)` 속성으로 직접 전달됩니다.

 `RevisionWeights`   <a name="sam-webfunction-revisionweights"></a>
트래픽 가중치에 대한 개정 IDs의 맵입니다. 이 `AutoDeploymentMode`인 경우이 속성을 사용합니다`Disabled`. 최대 2개의 개정을 지정합니다. 각 가중치는 1\~100의 정수이며 가중치는 최대 100이어야 합니다.  
*유형*: [RevisionWeights](sam-property-webfunction-revisionweights.md)  
*필수 항목 여부*: 조건부. `AutoDeploymentMode`이 `Disabled` 이고이 `EndpointType`인 경우 필요합니다`HomeRegion`.  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunctionEndpoint` 리소스의 `[RevisionWeights](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-lambda-webfunctionendpoint.html#cfn-lambda-webfunctionendpoint-revisionweights)` 속성과 유사합니다. 맵을 `RevisionId` 및 `Weight` 객체 목록으로 AWS SAM 변환합니다.

 `Runtime`   <a name="sam-webfunction-runtime"></a>
함수의 런타임. 예: `nodejs24.x`.  
*유형:* 문자열  
*필수 항목 여부:* 예  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunctionRevision` 리소스의 `[BuildConfig.RuntimeConfig.Runtime](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-lambda-webfunctionrevision-runtimeconfig.html#cfn-lambda-webfunctionrevision-runtimeconfig-runtime)` 속성으로 직접 전달됩니다.

 `ScalingConfig`   <a name="sam-webfunction-scalingconfig"></a>
최대 실행 환경 수와 같은 엔드포인트의 조정 구성입니다.  
*유형*: 맵  
*필수 항목 여부:* 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunctionEndpoint` 리소스의 `[ScalingConfig](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-lambda-webfunctionendpoint.html#cfn-lambda-webfunctionendpoint-scalingconfig)` 속성으로 직접 전달됩니다.

 `Tags`   <a name="sam-webfunction-tags"></a>
가 AWS SAM 생성하는 함수 및 실행 역할에 추가된 태그를 지정하는 키-값 페어의 맵입니다.  
*유형*: 맵  
*필수 항목 여부:* 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunction` 리소스의 `[Tags](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-lambda-webfunction.html#cfn-lambda-webfunction-tags)` 속성과 유사합니다. 의 `Tags` AWS SAM 속성은 키-값 페어로 구성됩니다(이 CloudFormation 속성은 `Tag` 객체 목록으로 구성됨). 또한는 함수와 해당 함수에 대해 생성된 기본 역할에 `lambda:createdBy:SAM` 태그를 AWS SAM 자동으로 추가합니다.

 `ThrottleConfig`   <a name="sam-webfunction-throttleconfig"></a>
최대 요청 속도와 같은 엔드포인트의 제한 구성입니다.  
*유형*: 맵  
*필수 항목 여부:* 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunctionEndpoint` 리소스의 `[ThrottleConfig](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-lambda-webfunctionendpoint.html#cfn-lambda-webfunctionendpoint-throttleconfig)` 속성으로 직접 전달됩니다.

 `Timeout`   <a name="sam-webfunction-timeout"></a>
요청당 함수를 실행할 수 있는 초 단위의 최대 시간입니다. 유효한 값은 3\~900입니다.  
*유형*: 정수  
*필수 항목 여부*: 아니요  
*기본값*: `30`  
*CloudFormation 호환성*:이 속성은 `AWS::Lambda::WebFunctionRevision` 리소스의 `[ServiceConfig.TimeoutSeconds](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-lambda-webfunctionrevision-serviceconfig.html#cfn-lambda-webfunctionrevision-serviceconfig-timeoutseconds)` 속성으로 직접 전달됩니다.

## 반환 값
<a name="sam-resource-webfunction-return-values"></a>

### Ref
<a name="sam-resource-webfunction-return-values-ref"></a>

이 리소스의 논리적 ID가 `Ref` 내장 함수에 제공되면 웹 함수의 ARN을 반환합니다. 함수 이름이 필요한 경우 `FunctionName` 대신의 값을 사용합니다.

`Ref` 함수의 사용에 대한 자세한 내용은 *AWS CloudFormation 사용자 가이드*의 [`Ref`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html) 섹션을 참조하세요.

### Fn::GetAtt
<a name="sam-resource-webfunction-return-values-fn--getatt"></a>

`Fn::GetAtt`은 이 유형의 지정된 속성에 대한 값을 반환합니다. 다음은 사용 가능한 속성과 반환되는 샘플 값.

`Fn::GetAtt`의 사용에 대한 자세한 내용은 *AWS CloudFormation 사용자 가이드*의 [`Fn::GetAtt`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html) 섹션을 참조하세요.

`FunctionArn`  <a name="sam-webfunction-getatt-functionarn"></a>
웹 함수의 Amazon 리소스 이름(ARN)입니다.

`State`  <a name="sam-webfunction-getatt-state"></a>
웹 함수의 현재 상태입니다.

`StateReason`  <a name="sam-webfunction-getatt-statereason"></a>
웹 함수의 현재 상태에 대한 이유입니다.

`CreatedAt`  <a name="sam-webfunction-getatt-createdat"></a>
웹 함수가 생성된 시간입니다.

`UpdatedAt`  <a name="sam-webfunction-getatt-updatedat"></a>
웹 함수가 마지막으로 업데이트된 시간입니다.

가 AWS SAM 생성하는 개정 또는 엔드포인트를 참조하려면 논리적 IDs `{{<resource-logical-id>}}Revision` 및를 사용합니다`{{<resource-logical-id>}}Endpoint`. 예를 들어는 논리적 ID가 인 웹 함수에 대한 엔드포인트의 도메인 이름을 `!GetAtt MyWebFunctionEndpoint.DomainName` 반환합니다`MyWebFunction`. 자세한 내용은 [CloudFormation AWS::Serverless::WebFunction가 지정될 때 생성되는 리소스](sam-specification-generated-resources-webfunction.md) 섹션을 참조하세요.

## 예제
<a name="sam-resource-webfunction-examples"></a>

### 기본 웹 함수
<a name="sam-resource-webfunction-example-basic"></a>

다음 예제에서는 스택의 리전에 IAM 인증 엔드포인트가 있는 웹 함수를 생성합니다.는 실행 역할을 AWS SAM 생성하고 엔드포인트는이 배포가 생성하는 개정으로 모든 트래픽을 라우팅합니다.

```
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31

Resources:
  MyWebFunction:
    Type: AWS::Serverless::WebFunction
    Properties:
      Runtime: nodejs24.x
      AuthType: IamAuth
      CodeUri:
        Bucket: amzn-s3-demo-bucket
        Key: webfn.zip
        Version: {{object-version-id}}
      Timeout: 30

Outputs:
  EndpointUrl:
    Value: !Sub https://${MyWebFunctionEndpoint.DomainName}
```

### 두 개정 간에 트래픽 분할
<a name="sam-resource-webfunction-example-canary"></a>

다음 예시에서는 자동 배포를 비활성화하고 트래픽의 90%를 기존 개정으로 보내고 10%를 다른 개정으로 보냅니다. 두 개정이 모두 이미 있어야 합니다.

```
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31

Resources:
  MyWebFunction:
    Type: AWS::Serverless::WebFunction
    Properties:
      Runtime: nodejs24.x
      AuthType: IamAuth
      CodeUri: s3://amzn-s3-demo-bucket/webfn-v2.zip
      AutoDeploymentMode: Disabled
      RevisionWeights:
        rev-abc123: 90
        rev-def456: 10
```

### 다중 리전 웹 함수
<a name="sam-resource-webfunction-example-multiregion"></a>

다음 예제에서는 함수를를 제외한 미국 리전으로 복제`us-west-1`하고 각 요청을 가장 가까운 리전으로 라우팅합니다. `RevisionWeights`는 생략되므로 엔드포인트는 모든 트래픽을이 스택에서 생성된 개정으로 라우팅합니다.

```
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31

Resources:
  MyWebFunction:
    Type: AWS::Serverless::WebFunction
    Properties:
      Runtime: nodejs24.x
      AuthType: IamAuth
      CodeUri:
        Bucket: amzn-s3-demo-bucket
        Key: webfn.zip
        Version: {{object-version-id}}
      EndpointName: prodmr
      EndpointType: MultiRegion
      AutoDeploymentMode: Disabled
      ReplicaRegions:
        IncludeRegions:
          - US
        ExcludeRegions:
          - us-west-1
```

### VPC 송신을 사용하는 웹 함수
<a name="sam-resource-webfunction-example-vpc-egress"></a>

다음 예제에서는 Web Functions용 네트워크 커넥터를 생성하고 커넥터의 서브넷 및 보안 그룹을 통해 함수의 아웃바운드 트래픽을 라우팅합니다.

```
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31

Resources:
  MyConnector:
    Type: AWS::Serverless::NetworkConnector
    Properties:
      ComputeTypes:
        - WebFunction
      VpcConfig:
        SubnetIds:
          - subnet-0abc123def4567890
          - subnet-0def456abc7890123
        SecurityGroupIds:
          - sg-0abc1234abcde0001
        NetworkProtocol: IPv4

  MyWebFunction:
    Type: AWS::Serverless::WebFunction
    Properties:
      Runtime: nodejs24.x
      AuthType: IamAuth
      CodeUri:
        Bucket: amzn-s3-demo-bucket
        Key: webfn.zip
        Version: {{object-version-id}}
      EgressNetworkConnectorArn: !GetAtt MyConnector.LatestVersionArn
```