Try AWS Native preview for resources not in the classic version.
aws.apigateway.Authorizer
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
Provides an API Gateway Authorizer.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var demoRestApi = new Aws.ApiGateway.RestApi("demoRestApi");
var invocationAssumeRole = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Effect = "Allow",
Principals = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
{
Type = "Service",
Identifiers = new[]
{
"apigateway.amazonaws.com",
},
},
},
Actions = new[]
{
"sts:AssumeRole",
},
},
},
});
var invocationRole = new Aws.Iam.Role("invocationRole", new()
{
Path = "/",
AssumeRolePolicy = invocationAssumeRole.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
});
var lambdaAssumeRole = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Effect = "Allow",
Actions = new[]
{
"sts:AssumeRole",
},
Principals = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
{
Type = "Service",
Identifiers = new[]
{
"lambda.amazonaws.com",
},
},
},
},
},
});
var lambda = new Aws.Iam.Role("lambda", new()
{
AssumeRolePolicy = lambdaAssumeRole.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
});
var authorizer = new Aws.Lambda.Function("authorizer", new()
{
Code = new FileArchive("lambda-function.zip"),
Role = lambda.Arn,
Handler = "exports.example",
});
var demoAuthorizer = new Aws.ApiGateway.Authorizer("demoAuthorizer", new()
{
RestApi = demoRestApi.Id,
AuthorizerUri = authorizer.InvokeArn,
AuthorizerCredentials = invocationRole.Arn,
});
var invocationPolicyPolicyDocument = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Effect = "Allow",
Actions = new[]
{
"lambda:InvokeFunction",
},
Resources = new[]
{
authorizer.Arn,
},
},
},
});
var invocationPolicyRolePolicy = new Aws.Iam.RolePolicy("invocationPolicyRolePolicy", new()
{
Role = invocationRole.Id,
Policy = invocationPolicyPolicyDocument.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigateway"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
demoRestApi, err := apigateway.NewRestApi(ctx, "demoRestApi", nil)
if err != nil {
return err
}
invocationAssumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
{
Effect: pulumi.StringRef("Allow"),
Principals: []iam.GetPolicyDocumentStatementPrincipal{
{
Type: "Service",
Identifiers: []string{
"apigateway.amazonaws.com",
},
},
},
Actions: []string{
"sts:AssumeRole",
},
},
},
}, nil)
if err != nil {
return err
}
invocationRole, err := iam.NewRole(ctx, "invocationRole", &iam.RoleArgs{
Path: pulumi.String("/"),
AssumeRolePolicy: *pulumi.String(invocationAssumeRole.Json),
})
if err != nil {
return err
}
lambdaAssumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
{
Effect: pulumi.StringRef("Allow"),
Actions: []string{
"sts:AssumeRole",
},
Principals: []iam.GetPolicyDocumentStatementPrincipal{
{
Type: "Service",
Identifiers: []string{
"lambda.amazonaws.com",
},
},
},
},
},
}, nil)
if err != nil {
return err
}
lambda, err := iam.NewRole(ctx, "lambda", &iam.RoleArgs{
AssumeRolePolicy: *pulumi.String(lambdaAssumeRole.Json),
})
if err != nil {
return err
}
authorizer, err := lambda.NewFunction(ctx, "authorizer", &lambda.FunctionArgs{
Code: pulumi.NewFileArchive("lambda-function.zip"),
Role: lambda.Arn,
Handler: pulumi.String("exports.example"),
})
if err != nil {
return err
}
_, err = apigateway.NewAuthorizer(ctx, "demoAuthorizer", &apigateway.AuthorizerArgs{
RestApi: demoRestApi.ID(),
AuthorizerUri: authorizer.InvokeArn,
AuthorizerCredentials: invocationRole.Arn,
})
if err != nil {
return err
}
invocationPolicyPolicyDocument := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
Statements: iam.GetPolicyDocumentStatementArray{
&iam.GetPolicyDocumentStatementArgs{
Effect: pulumi.String("Allow"),
Actions: pulumi.StringArray{
pulumi.String("lambda:InvokeFunction"),
},
Resources: pulumi.StringArray{
authorizer.Arn,
},
},
},
}, nil)
_, err = iam.NewRolePolicy(ctx, "invocationPolicyRolePolicy", &iam.RolePolicyArgs{
Role: invocationRole.ID(),
Policy: invocationPolicyPolicyDocument.ApplyT(func(invocationPolicyPolicyDocument iam.GetPolicyDocumentResult) (*string, error) {
return &invocationPolicyPolicyDocument.Json, nil
}).(pulumi.StringPtrOutput),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.apigateway.RestApi;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.lambda.Function;
import com.pulumi.aws.lambda.FunctionArgs;
import com.pulumi.aws.apigateway.Authorizer;
import com.pulumi.aws.apigateway.AuthorizerArgs;
import com.pulumi.aws.iam.RolePolicy;
import com.pulumi.aws.iam.RolePolicyArgs;
import com.pulumi.asset.FileArchive;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var demoRestApi = new RestApi("demoRestApi");
final var invocationAssumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers("apigateway.amazonaws.com")
.build())
.actions("sts:AssumeRole")
.build())
.build());
var invocationRole = new Role("invocationRole", RoleArgs.builder()
.path("/")
.assumeRolePolicy(invocationAssumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
final var lambdaAssumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.actions("sts:AssumeRole")
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers("lambda.amazonaws.com")
.build())
.build())
.build());
var lambda = new Role("lambda", RoleArgs.builder()
.assumeRolePolicy(lambdaAssumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
var authorizer = new Function("authorizer", FunctionArgs.builder()
.code(new FileArchive("lambda-function.zip"))
.role(lambda.arn())
.handler("exports.example")
.build());
var demoAuthorizer = new Authorizer("demoAuthorizer", AuthorizerArgs.builder()
.restApi(demoRestApi.id())
.authorizerUri(authorizer.invokeArn())
.authorizerCredentials(invocationRole.arn())
.build());
final var invocationPolicyPolicyDocument = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.actions("lambda:InvokeFunction")
.resources(authorizer.arn())
.build())
.build());
var invocationPolicyRolePolicy = new RolePolicy("invocationPolicyRolePolicy", RolePolicyArgs.builder()
.role(invocationRole.id())
.policy(invocationPolicyPolicyDocument.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult).applyValue(invocationPolicyPolicyDocument -> invocationPolicyPolicyDocument.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
.build());
}
}
import pulumi
import pulumi_aws as aws
demo_rest_api = aws.apigateway.RestApi("demoRestApi")
invocation_assume_role = aws.iam.get_policy_document(statements=[aws.iam.GetPolicyDocumentStatementArgs(
effect="Allow",
principals=[aws.iam.GetPolicyDocumentStatementPrincipalArgs(
type="Service",
identifiers=["apigateway.amazonaws.com"],
)],
actions=["sts:AssumeRole"],
)])
invocation_role = aws.iam.Role("invocationRole",
path="/",
assume_role_policy=invocation_assume_role.json)
lambda_assume_role = aws.iam.get_policy_document(statements=[aws.iam.GetPolicyDocumentStatementArgs(
effect="Allow",
actions=["sts:AssumeRole"],
principals=[aws.iam.GetPolicyDocumentStatementPrincipalArgs(
type="Service",
identifiers=["lambda.amazonaws.com"],
)],
)])
lambda_ = aws.iam.Role("lambda", assume_role_policy=lambda_assume_role.json)
authorizer = aws.lambda_.Function("authorizer",
code=pulumi.FileArchive("lambda-function.zip"),
role=lambda_.arn,
handler="exports.example")
demo_authorizer = aws.apigateway.Authorizer("demoAuthorizer",
rest_api=demo_rest_api.id,
authorizer_uri=authorizer.invoke_arn,
authorizer_credentials=invocation_role.arn)
invocation_policy_policy_document = aws.iam.get_policy_document_output(statements=[aws.iam.GetPolicyDocumentStatementArgs(
effect="Allow",
actions=["lambda:InvokeFunction"],
resources=[authorizer.arn],
)])
invocation_policy_role_policy = aws.iam.RolePolicy("invocationPolicyRolePolicy",
role=invocation_role.id,
policy=invocation_policy_policy_document.json)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const demoRestApi = new aws.apigateway.RestApi("demoRestApi", {});
const invocationAssumeRole = aws.iam.getPolicyDocument({
statements: [{
effect: "Allow",
principals: [{
type: "Service",
identifiers: ["apigateway.amazonaws.com"],
}],
actions: ["sts:AssumeRole"],
}],
});
const invocationRole = new aws.iam.Role("invocationRole", {
path: "/",
assumeRolePolicy: invocationAssumeRole.then(invocationAssumeRole => invocationAssumeRole.json),
});
const lambdaAssumeRole = aws.iam.getPolicyDocument({
statements: [{
effect: "Allow",
actions: ["sts:AssumeRole"],
principals: [{
type: "Service",
identifiers: ["lambda.amazonaws.com"],
}],
}],
});
const lambda = new aws.iam.Role("lambda", {assumeRolePolicy: lambdaAssumeRole.then(lambdaAssumeRole => lambdaAssumeRole.json)});
const authorizer = new aws.lambda.Function("authorizer", {
code: new pulumi.asset.FileArchive("lambda-function.zip"),
role: lambda.arn,
handler: "exports.example",
});
const demoAuthorizer = new aws.apigateway.Authorizer("demoAuthorizer", {
restApi: demoRestApi.id,
authorizerUri: authorizer.invokeArn,
authorizerCredentials: invocationRole.arn,
});
const invocationPolicyPolicyDocument = aws.iam.getPolicyDocumentOutput({
statements: [{
effect: "Allow",
actions: ["lambda:InvokeFunction"],
resources: [authorizer.arn],
}],
});
const invocationPolicyRolePolicy = new aws.iam.RolePolicy("invocationPolicyRolePolicy", {
role: invocationRole.id,
policy: invocationPolicyPolicyDocument.apply(invocationPolicyPolicyDocument => invocationPolicyPolicyDocument.json),
});
resources:
demoAuthorizer:
type: aws:apigateway:Authorizer
properties:
restApi: ${demoRestApi.id}
authorizerUri: ${authorizer.invokeArn}
authorizerCredentials: ${invocationRole.arn}
demoRestApi:
type: aws:apigateway:RestApi
invocationRole:
type: aws:iam:Role
properties:
path: /
assumeRolePolicy: ${invocationAssumeRole.json}
invocationPolicyRolePolicy:
type: aws:iam:RolePolicy
properties:
role: ${invocationRole.id}
policy: ${invocationPolicyPolicyDocument.json}
lambda:
type: aws:iam:Role
properties:
assumeRolePolicy: ${lambdaAssumeRole.json}
authorizer:
type: aws:lambda:Function
properties:
code:
fn::FileArchive: lambda-function.zip
role: ${lambda.arn}
handler: exports.example
variables:
invocationAssumeRole:
fn::invoke:
Function: aws:iam:getPolicyDocument
Arguments:
statements:
- effect: Allow
principals:
- type: Service
identifiers:
- apigateway.amazonaws.com
actions:
- sts:AssumeRole
invocationPolicyPolicyDocument:
fn::invoke:
Function: aws:iam:getPolicyDocument
Arguments:
statements:
- effect: Allow
actions:
- lambda:InvokeFunction
resources:
- ${authorizer.arn}
lambdaAssumeRole:
fn::invoke:
Function: aws:iam:getPolicyDocument
Arguments:
statements:
- effect: Allow
actions:
- sts:AssumeRole
principals:
- type: Service
identifiers:
- lambda.amazonaws.com
Create Authorizer Resource
new Authorizer(name: string, args: AuthorizerArgs, opts?: CustomResourceOptions);
@overload
def Authorizer(resource_name: str,
opts: Optional[ResourceOptions] = None,
authorizer_credentials: Optional[str] = None,
authorizer_result_ttl_in_seconds: Optional[int] = None,
authorizer_uri: Optional[str] = None,
identity_source: Optional[str] = None,
identity_validation_expression: Optional[str] = None,
name: Optional[str] = None,
provider_arns: Optional[Sequence[str]] = None,
rest_api: Optional[str] = None,
type: Optional[str] = None)
@overload
def Authorizer(resource_name: str,
args: AuthorizerArgs,
opts: Optional[ResourceOptions] = None)
func NewAuthorizer(ctx *Context, name string, args AuthorizerArgs, opts ...ResourceOption) (*Authorizer, error)
public Authorizer(string name, AuthorizerArgs args, CustomResourceOptions? opts = null)
public Authorizer(String name, AuthorizerArgs args)
public Authorizer(String name, AuthorizerArgs args, CustomResourceOptions options)
type: aws:apigateway:Authorizer
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args AuthorizerArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args AuthorizerArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args AuthorizerArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args AuthorizerArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args AuthorizerArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Authorizer Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Authorizer resource accepts the following input properties:
- Rest
Api string | string ID of the associated REST API
- string
Credentials required for the authorizer. To specify an IAM Role for API Gateway to assume, use the IAM Role ARN.
- int
TTL of cached authorizer results in seconds. Defaults to
300
.- string
Authorizer's Uniform Resource Identifier (URI). This must be a well-formed Lambda function URI in the form of
arn:aws:apigateway:{region}:lambda:path/{service_api}
, e.g.,arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:012345678912:function:my-function/invocations
- Identity
Source string Source of the identity in an incoming request. Defaults to
method.request.header.Authorization
. ForREQUEST
type, this may be a comma-separated list of values, including headers, query string parameters and stage variables - e.g.,"method.request.header.SomeHeaderName,method.request.querystring.SomeQueryStringName,stageVariables.SomeStageVariableName"
- Identity
Validation stringExpression Validation expression for the incoming identity. For
TOKEN
type, this value should be a regular expression. The incoming token from the client is matched against this expression, and will proceed if the token matches. If the token doesn't match, the client receives a 401 Unauthorized response.- Name string
Name of the authorizer
- Provider
Arns List<string> List of the Amazon Cognito user pool ARNs. Each element is of this format:
arn:aws:cognito-idp:{region}:{account_id}:userpool/{user_pool_id}
.- Type string
Type of the authorizer. Possible values are
TOKEN
for a Lambda function using a single authorization token submitted in a custom header,REQUEST
for a Lambda function using incoming request parameters, orCOGNITO_USER_POOLS
for using an Amazon Cognito user pool. Defaults toTOKEN
.
- Rest
Api string | string ID of the associated REST API
- string
Credentials required for the authorizer. To specify an IAM Role for API Gateway to assume, use the IAM Role ARN.
- int
TTL of cached authorizer results in seconds. Defaults to
300
.- string
Authorizer's Uniform Resource Identifier (URI). This must be a well-formed Lambda function URI in the form of
arn:aws:apigateway:{region}:lambda:path/{service_api}
, e.g.,arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:012345678912:function:my-function/invocations
- Identity
Source string Source of the identity in an incoming request. Defaults to
method.request.header.Authorization
. ForREQUEST
type, this may be a comma-separated list of values, including headers, query string parameters and stage variables - e.g.,"method.request.header.SomeHeaderName,method.request.querystring.SomeQueryStringName,stageVariables.SomeStageVariableName"
- Identity
Validation stringExpression Validation expression for the incoming identity. For
TOKEN
type, this value should be a regular expression. The incoming token from the client is matched against this expression, and will proceed if the token matches. If the token doesn't match, the client receives a 401 Unauthorized response.- Name string
Name of the authorizer
- Provider
Arns []string List of the Amazon Cognito user pool ARNs. Each element is of this format:
arn:aws:cognito-idp:{region}:{account_id}:userpool/{user_pool_id}
.- Type string
Type of the authorizer. Possible values are
TOKEN
for a Lambda function using a single authorization token submitted in a custom header,REQUEST
for a Lambda function using incoming request parameters, orCOGNITO_USER_POOLS
for using an Amazon Cognito user pool. Defaults toTOKEN
.
- rest
Api String | String ID of the associated REST API
- String
Credentials required for the authorizer. To specify an IAM Role for API Gateway to assume, use the IAM Role ARN.
- Integer
TTL of cached authorizer results in seconds. Defaults to
300
.- String
Authorizer's Uniform Resource Identifier (URI). This must be a well-formed Lambda function URI in the form of
arn:aws:apigateway:{region}:lambda:path/{service_api}
, e.g.,arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:012345678912:function:my-function/invocations
- identity
Source String Source of the identity in an incoming request. Defaults to
method.request.header.Authorization
. ForREQUEST
type, this may be a comma-separated list of values, including headers, query string parameters and stage variables - e.g.,"method.request.header.SomeHeaderName,method.request.querystring.SomeQueryStringName,stageVariables.SomeStageVariableName"
- identity
Validation StringExpression Validation expression for the incoming identity. For
TOKEN
type, this value should be a regular expression. The incoming token from the client is matched against this expression, and will proceed if the token matches. If the token doesn't match, the client receives a 401 Unauthorized response.- name String
Name of the authorizer
- provider
Arns List<String> List of the Amazon Cognito user pool ARNs. Each element is of this format:
arn:aws:cognito-idp:{region}:{account_id}:userpool/{user_pool_id}
.- type String
Type of the authorizer. Possible values are
TOKEN
for a Lambda function using a single authorization token submitted in a custom header,REQUEST
for a Lambda function using incoming request parameters, orCOGNITO_USER_POOLS
for using an Amazon Cognito user pool. Defaults toTOKEN
.
- rest
Api string | RestApi ID of the associated REST API
- string
Credentials required for the authorizer. To specify an IAM Role for API Gateway to assume, use the IAM Role ARN.
- number
TTL of cached authorizer results in seconds. Defaults to
300
.- string
Authorizer's Uniform Resource Identifier (URI). This must be a well-formed Lambda function URI in the form of
arn:aws:apigateway:{region}:lambda:path/{service_api}
, e.g.,arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:012345678912:function:my-function/invocations
- identity
Source string Source of the identity in an incoming request. Defaults to
method.request.header.Authorization
. ForREQUEST
type, this may be a comma-separated list of values, including headers, query string parameters and stage variables - e.g.,"method.request.header.SomeHeaderName,method.request.querystring.SomeQueryStringName,stageVariables.SomeStageVariableName"
- identity
Validation stringExpression Validation expression for the incoming identity. For
TOKEN
type, this value should be a regular expression. The incoming token from the client is matched against this expression, and will proceed if the token matches. If the token doesn't match, the client receives a 401 Unauthorized response.- name string
Name of the authorizer
- provider
Arns string[] List of the Amazon Cognito user pool ARNs. Each element is of this format:
arn:aws:cognito-idp:{region}:{account_id}:userpool/{user_pool_id}
.- type string
Type of the authorizer. Possible values are
TOKEN
for a Lambda function using a single authorization token submitted in a custom header,REQUEST
for a Lambda function using incoming request parameters, orCOGNITO_USER_POOLS
for using an Amazon Cognito user pool. Defaults toTOKEN
.
- rest_
api str | str ID of the associated REST API
- str
Credentials required for the authorizer. To specify an IAM Role for API Gateway to assume, use the IAM Role ARN.
- int
TTL of cached authorizer results in seconds. Defaults to
300
.- str
Authorizer's Uniform Resource Identifier (URI). This must be a well-formed Lambda function URI in the form of
arn:aws:apigateway:{region}:lambda:path/{service_api}
, e.g.,arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:012345678912:function:my-function/invocations
- identity_
source str Source of the identity in an incoming request. Defaults to
method.request.header.Authorization
. ForREQUEST
type, this may be a comma-separated list of values, including headers, query string parameters and stage variables - e.g.,"method.request.header.SomeHeaderName,method.request.querystring.SomeQueryStringName,stageVariables.SomeStageVariableName"
- identity_
validation_ strexpression Validation expression for the incoming identity. For
TOKEN
type, this value should be a regular expression. The incoming token from the client is matched against this expression, and will proceed if the token matches. If the token doesn't match, the client receives a 401 Unauthorized response.- name str
Name of the authorizer
- provider_
arns Sequence[str] List of the Amazon Cognito user pool ARNs. Each element is of this format:
arn:aws:cognito-idp:{region}:{account_id}:userpool/{user_pool_id}
.- type str
Type of the authorizer. Possible values are
TOKEN
for a Lambda function using a single authorization token submitted in a custom header,REQUEST
for a Lambda function using incoming request parameters, orCOGNITO_USER_POOLS
for using an Amazon Cognito user pool. Defaults toTOKEN
.
- rest
Api String | ID of the associated REST API
- String
Credentials required for the authorizer. To specify an IAM Role for API Gateway to assume, use the IAM Role ARN.
- Number
TTL of cached authorizer results in seconds. Defaults to
300
.- String
Authorizer's Uniform Resource Identifier (URI). This must be a well-formed Lambda function URI in the form of
arn:aws:apigateway:{region}:lambda:path/{service_api}
, e.g.,arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:012345678912:function:my-function/invocations
- identity
Source String Source of the identity in an incoming request. Defaults to
method.request.header.Authorization
. ForREQUEST
type, this may be a comma-separated list of values, including headers, query string parameters and stage variables - e.g.,"method.request.header.SomeHeaderName,method.request.querystring.SomeQueryStringName,stageVariables.SomeStageVariableName"
- identity
Validation StringExpression Validation expression for the incoming identity. For
TOKEN
type, this value should be a regular expression. The incoming token from the client is matched against this expression, and will proceed if the token matches. If the token doesn't match, the client receives a 401 Unauthorized response.- name String
Name of the authorizer
- provider
Arns List<String> List of the Amazon Cognito user pool ARNs. Each element is of this format:
arn:aws:cognito-idp:{region}:{account_id}:userpool/{user_pool_id}
.- type String
Type of the authorizer. Possible values are
TOKEN
for a Lambda function using a single authorization token submitted in a custom header,REQUEST
for a Lambda function using incoming request parameters, orCOGNITO_USER_POOLS
for using an Amazon Cognito user pool. Defaults toTOKEN
.
Outputs
All input properties are implicitly available as output properties. Additionally, the Authorizer resource produces the following output properties:
Look up Existing Authorizer Resource
Get an existing Authorizer resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: AuthorizerState, opts?: CustomResourceOptions): Authorizer
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
arn: Optional[str] = None,
authorizer_credentials: Optional[str] = None,
authorizer_result_ttl_in_seconds: Optional[int] = None,
authorizer_uri: Optional[str] = None,
identity_source: Optional[str] = None,
identity_validation_expression: Optional[str] = None,
name: Optional[str] = None,
provider_arns: Optional[Sequence[str]] = None,
rest_api: Optional[str] = None,
type: Optional[str] = None) -> Authorizer
func GetAuthorizer(ctx *Context, name string, id IDInput, state *AuthorizerState, opts ...ResourceOption) (*Authorizer, error)
public static Authorizer Get(string name, Input<string> id, AuthorizerState? state, CustomResourceOptions? opts = null)
public static Authorizer get(String name, Output<String> id, AuthorizerState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Arn string
ARN of the API Gateway Authorizer
- string
Credentials required for the authorizer. To specify an IAM Role for API Gateway to assume, use the IAM Role ARN.
- int
TTL of cached authorizer results in seconds. Defaults to
300
.- string
Authorizer's Uniform Resource Identifier (URI). This must be a well-formed Lambda function URI in the form of
arn:aws:apigateway:{region}:lambda:path/{service_api}
, e.g.,arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:012345678912:function:my-function/invocations
- Identity
Source string Source of the identity in an incoming request. Defaults to
method.request.header.Authorization
. ForREQUEST
type, this may be a comma-separated list of values, including headers, query string parameters and stage variables - e.g.,"method.request.header.SomeHeaderName,method.request.querystring.SomeQueryStringName,stageVariables.SomeStageVariableName"
- Identity
Validation stringExpression Validation expression for the incoming identity. For
TOKEN
type, this value should be a regular expression. The incoming token from the client is matched against this expression, and will proceed if the token matches. If the token doesn't match, the client receives a 401 Unauthorized response.- Name string
Name of the authorizer
- Provider
Arns List<string> List of the Amazon Cognito user pool ARNs. Each element is of this format:
arn:aws:cognito-idp:{region}:{account_id}:userpool/{user_pool_id}
.- Rest
Api string | string ID of the associated REST API
- Type string
Type of the authorizer. Possible values are
TOKEN
for a Lambda function using a single authorization token submitted in a custom header,REQUEST
for a Lambda function using incoming request parameters, orCOGNITO_USER_POOLS
for using an Amazon Cognito user pool. Defaults toTOKEN
.
- Arn string
ARN of the API Gateway Authorizer
- string
Credentials required for the authorizer. To specify an IAM Role for API Gateway to assume, use the IAM Role ARN.
- int
TTL of cached authorizer results in seconds. Defaults to
300
.- string
Authorizer's Uniform Resource Identifier (URI). This must be a well-formed Lambda function URI in the form of
arn:aws:apigateway:{region}:lambda:path/{service_api}
, e.g.,arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:012345678912:function:my-function/invocations
- Identity
Source string Source of the identity in an incoming request. Defaults to
method.request.header.Authorization
. ForREQUEST
type, this may be a comma-separated list of values, including headers, query string parameters and stage variables - e.g.,"method.request.header.SomeHeaderName,method.request.querystring.SomeQueryStringName,stageVariables.SomeStageVariableName"
- Identity
Validation stringExpression Validation expression for the incoming identity. For
TOKEN
type, this value should be a regular expression. The incoming token from the client is matched against this expression, and will proceed if the token matches. If the token doesn't match, the client receives a 401 Unauthorized response.- Name string
Name of the authorizer
- Provider
Arns []string List of the Amazon Cognito user pool ARNs. Each element is of this format:
arn:aws:cognito-idp:{region}:{account_id}:userpool/{user_pool_id}
.- Rest
Api string | string ID of the associated REST API
- Type string
Type of the authorizer. Possible values are
TOKEN
for a Lambda function using a single authorization token submitted in a custom header,REQUEST
for a Lambda function using incoming request parameters, orCOGNITO_USER_POOLS
for using an Amazon Cognito user pool. Defaults toTOKEN
.
- arn String
ARN of the API Gateway Authorizer
- String
Credentials required for the authorizer. To specify an IAM Role for API Gateway to assume, use the IAM Role ARN.
- Integer
TTL of cached authorizer results in seconds. Defaults to
300
.- String
Authorizer's Uniform Resource Identifier (URI). This must be a well-formed Lambda function URI in the form of
arn:aws:apigateway:{region}:lambda:path/{service_api}
, e.g.,arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:012345678912:function:my-function/invocations
- identity
Source String Source of the identity in an incoming request. Defaults to
method.request.header.Authorization
. ForREQUEST
type, this may be a comma-separated list of values, including headers, query string parameters and stage variables - e.g.,"method.request.header.SomeHeaderName,method.request.querystring.SomeQueryStringName,stageVariables.SomeStageVariableName"
- identity
Validation StringExpression Validation expression for the incoming identity. For
TOKEN
type, this value should be a regular expression. The incoming token from the client is matched against this expression, and will proceed if the token matches. If the token doesn't match, the client receives a 401 Unauthorized response.- name String
Name of the authorizer
- provider
Arns List<String> List of the Amazon Cognito user pool ARNs. Each element is of this format:
arn:aws:cognito-idp:{region}:{account_id}:userpool/{user_pool_id}
.- rest
Api String | String ID of the associated REST API
- type String
Type of the authorizer. Possible values are
TOKEN
for a Lambda function using a single authorization token submitted in a custom header,REQUEST
for a Lambda function using incoming request parameters, orCOGNITO_USER_POOLS
for using an Amazon Cognito user pool. Defaults toTOKEN
.
- arn string
ARN of the API Gateway Authorizer
- string
Credentials required for the authorizer. To specify an IAM Role for API Gateway to assume, use the IAM Role ARN.
- number
TTL of cached authorizer results in seconds. Defaults to
300
.- string
Authorizer's Uniform Resource Identifier (URI). This must be a well-formed Lambda function URI in the form of
arn:aws:apigateway:{region}:lambda:path/{service_api}
, e.g.,arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:012345678912:function:my-function/invocations
- identity
Source string Source of the identity in an incoming request. Defaults to
method.request.header.Authorization
. ForREQUEST
type, this may be a comma-separated list of values, including headers, query string parameters and stage variables - e.g.,"method.request.header.SomeHeaderName,method.request.querystring.SomeQueryStringName,stageVariables.SomeStageVariableName"
- identity
Validation stringExpression Validation expression for the incoming identity. For
TOKEN
type, this value should be a regular expression. The incoming token from the client is matched against this expression, and will proceed if the token matches. If the token doesn't match, the client receives a 401 Unauthorized response.- name string
Name of the authorizer
- provider
Arns string[] List of the Amazon Cognito user pool ARNs. Each element is of this format:
arn:aws:cognito-idp:{region}:{account_id}:userpool/{user_pool_id}
.- rest
Api string | RestApi ID of the associated REST API
- type string
Type of the authorizer. Possible values are
TOKEN
for a Lambda function using a single authorization token submitted in a custom header,REQUEST
for a Lambda function using incoming request parameters, orCOGNITO_USER_POOLS
for using an Amazon Cognito user pool. Defaults toTOKEN
.
- arn str
ARN of the API Gateway Authorizer
- str
Credentials required for the authorizer. To specify an IAM Role for API Gateway to assume, use the IAM Role ARN.
- int
TTL of cached authorizer results in seconds. Defaults to
300
.- str
Authorizer's Uniform Resource Identifier (URI). This must be a well-formed Lambda function URI in the form of
arn:aws:apigateway:{region}:lambda:path/{service_api}
, e.g.,arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:012345678912:function:my-function/invocations
- identity_
source str Source of the identity in an incoming request. Defaults to
method.request.header.Authorization
. ForREQUEST
type, this may be a comma-separated list of values, including headers, query string parameters and stage variables - e.g.,"method.request.header.SomeHeaderName,method.request.querystring.SomeQueryStringName,stageVariables.SomeStageVariableName"
- identity_
validation_ strexpression Validation expression for the incoming identity. For
TOKEN
type, this value should be a regular expression. The incoming token from the client is matched against this expression, and will proceed if the token matches. If the token doesn't match, the client receives a 401 Unauthorized response.- name str
Name of the authorizer
- provider_
arns Sequence[str] List of the Amazon Cognito user pool ARNs. Each element is of this format:
arn:aws:cognito-idp:{region}:{account_id}:userpool/{user_pool_id}
.- rest_
api str | str ID of the associated REST API
- type str
Type of the authorizer. Possible values are
TOKEN
for a Lambda function using a single authorization token submitted in a custom header,REQUEST
for a Lambda function using incoming request parameters, orCOGNITO_USER_POOLS
for using an Amazon Cognito user pool. Defaults toTOKEN
.
- arn String
ARN of the API Gateway Authorizer
- String
Credentials required for the authorizer. To specify an IAM Role for API Gateway to assume, use the IAM Role ARN.
- Number
TTL of cached authorizer results in seconds. Defaults to
300
.- String
Authorizer's Uniform Resource Identifier (URI). This must be a well-formed Lambda function URI in the form of
arn:aws:apigateway:{region}:lambda:path/{service_api}
, e.g.,arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:012345678912:function:my-function/invocations
- identity
Source String Source of the identity in an incoming request. Defaults to
method.request.header.Authorization
. ForREQUEST
type, this may be a comma-separated list of values, including headers, query string parameters and stage variables - e.g.,"method.request.header.SomeHeaderName,method.request.querystring.SomeQueryStringName,stageVariables.SomeStageVariableName"
- identity
Validation StringExpression Validation expression for the incoming identity. For
TOKEN
type, this value should be a regular expression. The incoming token from the client is matched against this expression, and will proceed if the token matches. If the token doesn't match, the client receives a 401 Unauthorized response.- name String
Name of the authorizer
- provider
Arns List<String> List of the Amazon Cognito user pool ARNs. Each element is of this format:
arn:aws:cognito-idp:{region}:{account_id}:userpool/{user_pool_id}
.- rest
Api String | ID of the associated REST API
- type String
Type of the authorizer. Possible values are
TOKEN
for a Lambda function using a single authorization token submitted in a custom header,REQUEST
for a Lambda function using incoming request parameters, orCOGNITO_USER_POOLS
for using an Amazon Cognito user pool. Defaults toTOKEN
.
Import
Using pulumi import
, import AWS API Gateway Authorizer using the REST-API-ID/AUTHORIZER-ID
. For example:
$ pulumi import aws:apigateway/authorizer:Authorizer authorizer 12345abcde/example
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aws
Terraform Provider.
Try AWS Native preview for resources not in the classic version.