Namespace Pulumi.Aws.ApiGateway
Classes
Account
Provides a settings of an API Gateway Account. Settings is applied region-wide per provider block.
Note: As there is no API method for deleting account settings or resetting it to defaults, destroying this resource will keep your account settings intact
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var cloudwatchRole = new Aws.Iam.Role("cloudwatchRole", new Aws.Iam.RoleArgs
{
AssumeRolePolicy = @"{
""Version"": ""2012-10-17"",
""Statement"": [
{
""Sid"": """",
""Effect"": ""Allow"",
""Principal"": {
""Service"": ""apigateway.amazonaws.com""
},
""Action"": ""sts:AssumeRole""
}
]
}
",
});
var demo = new Aws.ApiGateway.Account("demo", new Aws.ApiGateway.AccountArgs
{
CloudwatchRoleArn = cloudwatchRole.Arn,
});
var cloudwatchRolePolicy = new Aws.Iam.RolePolicy("cloudwatchRolePolicy", new Aws.Iam.RolePolicyArgs
{
Policy = @"{
""Version"": ""2012-10-17"",
""Statement"": [
{
""Effect"": ""Allow"",
""Action"": [
""logs:CreateLogGroup"",
""logs:CreateLogStream"",
""logs:DescribeLogGroups"",
""logs:DescribeLogStreams"",
""logs:PutLogEvents"",
""logs:GetLogEvents"",
""logs:FilterLogEvents""
],
""Resource"": ""*""
}
]
}
",
Role = cloudwatchRole.Id,
});
}
}
AccountArgs
AccountState
ApiKey
Provides an API Gateway API Key.
NOTE: Since the API Gateway usage plans feature was launched on August 11, 2016, usage plans are now required to associate an API key with an API stage.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var myDemoApiKey = new Aws.ApiGateway.ApiKey("myDemoApiKey", new Aws.ApiGateway.ApiKeyArgs
{
});
}
}
ApiKeyArgs
ApiKeyState
Authorizer
Provides an API Gateway Authorizer.
AuthorizerArgs
AuthorizerState
BasePathMapping
Connects a custom domain name registered via aws.apigateway.DomainName
with a deployed API so that its methods can be called via the
custom domain name.
Example Usage
using System.IO;
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleDeployment = new Aws.ApiGateway.Deployment("exampleDeployment", new Aws.ApiGateway.DeploymentArgs
{
RestApi = aws_api_gateway_rest_api.MyDemoAPI.Id,
StageName = "live",
});
var exampleDomainName = new Aws.ApiGateway.DomainName("exampleDomainName", new Aws.ApiGateway.DomainNameArgs
{
CertificateBody = File.ReadAllText($"{path.Module}/example.com/example.crt"),
CertificateChain = File.ReadAllText($"{path.Module}/example.com/ca.crt"),
CertificateName = "example-api",
CertificatePrivateKey = File.ReadAllText($"{path.Module}/example.com/example.key"),
DomainName = "example.com",
});
var test = new Aws.ApiGateway.BasePathMapping("test", new Aws.ApiGateway.BasePathMappingArgs
{
RestApi = aws_api_gateway_rest_api.MyDemoAPI.Id,
DomainName = exampleDomainName.Domain,
StageName = exampleDeployment.StageName,
});
}
}
BasePathMappingArgs
BasePathMappingState
ClientCertificate
Provides an API Gateway Client Certificate.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var demo = new Aws.ApiGateway.ClientCertificate("demo", new Aws.ApiGateway.ClientCertificateArgs
{
Description = "My client certificate",
});
}
}
ClientCertificateArgs
ClientCertificateState
Deployment
Provides an API Gateway REST Deployment.
Note: This resource depends on having at least one
aws.apigateway.Integrationcreated in the REST API, which itself has other dependencies. To avoid race conditions when all resources are being created together, you need to add implicit resource references via thetriggersargument or explicit resource references using the resourcedependsOnmeta-argument.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
{
Description = "This is my API for demonstration purposes",
});
var myDemoResource = new Aws.ApiGateway.Resource("myDemoResource", new Aws.ApiGateway.ResourceArgs
{
RestApi = myDemoAPI.Id,
ParentId = myDemoAPI.RootResourceId,
PathPart = "test",
});
var myDemoMethod = new Aws.ApiGateway.Method("myDemoMethod", new Aws.ApiGateway.MethodArgs
{
RestApi = myDemoAPI.Id,
ResourceId = myDemoResource.Id,
HttpMethod = "GET",
Authorization = "NONE",
});
var myDemoIntegration = new Aws.ApiGateway.Integration("myDemoIntegration", new Aws.ApiGateway.IntegrationArgs
{
RestApi = myDemoAPI.Id,
ResourceId = myDemoResource.Id,
HttpMethod = myDemoMethod.HttpMethod,
Type = "MOCK",
});
var myDemoDeployment = new Aws.ApiGateway.Deployment("myDemoDeployment", new Aws.ApiGateway.DeploymentArgs
{
RestApi = myDemoAPI.Id,
StageName = "test",
Variables =
{
{ "answer", "42" },
},
});
}
}
DeploymentArgs
DeploymentState
DocumentationPart
Provides a settings of an API Gateway Documentation Part.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleRestApi = new Aws.ApiGateway.RestApi("exampleRestApi", new Aws.ApiGateway.RestApiArgs
{
});
var exampleDocumentationPart = new Aws.ApiGateway.DocumentationPart("exampleDocumentationPart", new Aws.ApiGateway.DocumentationPartArgs
{
Location = new Aws.ApiGateway.Inputs.DocumentationPartLocationArgs
{
Method = "GET",
Path = "/example",
Type = "METHOD",
},
Properties = "{\"description\":\"Example description\"}",
RestApiId = exampleRestApi.Id,
});
}
}
DocumentationPartArgs
DocumentationPartState
DocumentationVersion
Provides a resource to manage an API Gateway Documentation Version.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleRestApi = new Aws.ApiGateway.RestApi("exampleRestApi", new Aws.ApiGateway.RestApiArgs
{
});
var exampleDocumentationVersion = new Aws.ApiGateway.DocumentationVersion("exampleDocumentationVersion", new Aws.ApiGateway.DocumentationVersionArgs
{
Description = "Example description",
RestApiId = exampleRestApi.Id,
Version = "example_version",
});
var exampleDocumentationPart = new Aws.ApiGateway.DocumentationPart("exampleDocumentationPart", new Aws.ApiGateway.DocumentationPartArgs
{
Location = new Aws.ApiGateway.Inputs.DocumentationPartLocationArgs
{
Type = "API",
},
Properties = "{\"description\":\"Example\"}",
RestApiId = exampleRestApi.Id,
});
}
}
DocumentationVersionArgs
DocumentationVersionState
DomainName
Registers a custom domain name for use with AWS API Gateway. Additional information about this functionality can be found in the API Gateway Developer Guide.
This resource just establishes ownership of and the TLS settings for
a particular domain name. An API can be attached to a particular path
under the registered domain name using
the aws.apigateway.BasePathMapping resource.
API Gateway domains can be defined as either 'edge-optimized' or 'regional'. In an edge-optimized configuration,
API Gateway internally creates and manages a CloudFront distribution to route requests on the given hostname. In
addition to this resource it's necessary to create a DNS record corresponding to the given domain name which is an alias
(either Route53 alias or traditional CNAME) to the Cloudfront domain name exported in the cloudfront_domain_name
attribute.
In a regional configuration, API Gateway does not create a CloudFront distribution to route requests to the API, though
a distribution can be created if needed. In either case, it is necessary to create a DNS record corresponding to the
given domain name which is an alias (either Route53 alias or traditional CNAME) to the regional domain name exported in
the regional_domain_name attribute.
Note: API Gateway requires the use of AWS Certificate Manager (ACM) certificates instead of Identity and Access Management (IAM) certificates in regions that support ACM. Regions that support ACM can be found in the Regions and Endpoints Documentation. To import an existing private key and certificate into ACM or request an ACM certificate, see the
aws.acm.Certificateresource.
Note: The
aws.apigateway.DomainNameresource expects dependency on theaws.acm.CertificateValidationas only verified certificates can be used. This can be made either explicitly by adding thedepends_on = [aws_acm_certificate_validation.cert]attribute. Or implicitly by referring certificate ARN from the validation resource where it will be available after the resource creation:regional_certificate_arn = aws_acm_certificate_validation.cert.certificate_arn.
Note: All arguments including the private key will be stored in the raw state as plain-text. Read more about sensitive data in state.
Example Usage
Edge Optimized (ACM Certificate)
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleDomainName = new Aws.ApiGateway.DomainName("exampleDomainName", new Aws.ApiGateway.DomainNameArgs
{
CertificateArn = aws_acm_certificate_validation.Example.Certificate_arn,
DomainName = "api.example.com",
});
// Example DNS record using Route53.
// Route53 is not specifically required; any DNS host can be used.
var exampleRecord = new Aws.Route53.Record("exampleRecord", new Aws.Route53.RecordArgs
{
Aliases =
{
new Aws.Route53.Inputs.RecordAliasArgs
{
EvaluateTargetHealth = true,
Name = exampleDomainName.CloudfrontDomainName,
ZoneId = exampleDomainName.CloudfrontZoneId,
},
},
Name = exampleDomainName.Domain,
Type = "A",
ZoneId = aws_route53_zone.Example.Id,
});
}
}
Edge Optimized (IAM Certificate)
using System.IO;
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleDomainName = new Aws.ApiGateway.DomainName("exampleDomainName", new Aws.ApiGateway.DomainNameArgs
{
CertificateBody = File.ReadAllText($"{path.Module}/example.com/example.crt"),
CertificateChain = File.ReadAllText($"{path.Module}/example.com/ca.crt"),
CertificateName = "example-api",
CertificatePrivateKey = File.ReadAllText($"{path.Module}/example.com/example.key"),
DomainName = "api.example.com",
});
// Example DNS record using Route53.
// Route53 is not specifically required; any DNS host can be used.
var exampleRecord = new Aws.Route53.Record("exampleRecord", new Aws.Route53.RecordArgs
{
Aliases =
{
new Aws.Route53.Inputs.RecordAliasArgs
{
EvaluateTargetHealth = true,
Name = exampleDomainName.CloudfrontDomainName,
ZoneId = exampleDomainName.CloudfrontZoneId,
},
},
Name = exampleDomainName.Domain,
Type = "A",
ZoneId = aws_route53_zone.Example.Id,
});
// See aws.route53.Zone for how to create this
}
}
Regional (ACM Certificate)
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleDomainName = new Aws.ApiGateway.DomainName("exampleDomainName", new Aws.ApiGateway.DomainNameArgs
{
DomainName = "api.example.com",
EndpointConfiguration = new Aws.ApiGateway.Inputs.DomainNameEndpointConfigurationArgs
{
Types = "REGIONAL",
},
RegionalCertificateArn = aws_acm_certificate_validation.Example.Certificate_arn,
});
// Example DNS record using Route53.
// Route53 is not specifically required; any DNS host can be used.
var exampleRecord = new Aws.Route53.Record("exampleRecord", new Aws.Route53.RecordArgs
{
Aliases =
{
new Aws.Route53.Inputs.RecordAliasArgs
{
EvaluateTargetHealth = true,
Name = exampleDomainName.RegionalDomainName,
ZoneId = exampleDomainName.RegionalZoneId,
},
},
Name = exampleDomainName.Domain,
Type = "A",
ZoneId = aws_route53_zone.Example.Id,
});
}
}
Regional (IAM Certificate)
using System.IO;
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleDomainName = new Aws.ApiGateway.DomainName("exampleDomainName", new Aws.ApiGateway.DomainNameArgs
{
CertificateBody = File.ReadAllText($"{path.Module}/example.com/example.crt"),
CertificateChain = File.ReadAllText($"{path.Module}/example.com/ca.crt"),
CertificatePrivateKey = File.ReadAllText($"{path.Module}/example.com/example.key"),
DomainName = "api.example.com",
EndpointConfiguration = new Aws.ApiGateway.Inputs.DomainNameEndpointConfigurationArgs
{
Types = "REGIONAL",
},
RegionalCertificateName = "example-api",
});
// Example DNS record using Route53.
// Route53 is not specifically required; any DNS host can be used.
var exampleRecord = new Aws.Route53.Record("exampleRecord", new Aws.Route53.RecordArgs
{
Aliases =
{
new Aws.Route53.Inputs.RecordAliasArgs
{
EvaluateTargetHealth = true,
Name = exampleDomainName.RegionalDomainName,
ZoneId = exampleDomainName.RegionalZoneId,
},
},
Name = exampleDomainName.Domain,
Type = "A",
ZoneId = aws_route53_zone.Example.Id,
});
}
}
DomainNameArgs
DomainNameState
GetKey
GetKeyArgs
GetKeyResult
GetResource
GetResourceArgs
GetResourceResult
GetRestApi
GetRestApiArgs
GetRestApiResult
GetVpcLink
GetVpcLinkArgs
GetVpcLinkResult
Integration
Provides an HTTP Method Integration for an API Gateway Integration.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
{
Description = "This is my API for demonstration purposes",
});
var myDemoResource = new Aws.ApiGateway.Resource("myDemoResource", new Aws.ApiGateway.ResourceArgs
{
ParentId = myDemoAPI.RootResourceId,
PathPart = "mydemoresource",
RestApi = myDemoAPI.Id,
});
var myDemoMethod = new Aws.ApiGateway.Method("myDemoMethod", new Aws.ApiGateway.MethodArgs
{
Authorization = "NONE",
HttpMethod = "GET",
ResourceId = myDemoResource.Id,
RestApi = myDemoAPI.Id,
});
var myDemoIntegration = new Aws.ApiGateway.Integration("myDemoIntegration", new Aws.ApiGateway.IntegrationArgs
{
CacheKeyParameters =
{
"method.request.path.param",
},
CacheNamespace = "foobar",
HttpMethod = myDemoMethod.HttpMethod,
RequestParameters =
{
{ "integration.request.header.X-Authorization", "'static'" },
},
RequestTemplates =
{
{ "application/xml", @"{
""body"" : $$input.json('$$')
}
" },
},
ResourceId = myDemoResource.Id,
RestApi = myDemoAPI.Id,
TimeoutMilliseconds = 29000,
Type = "MOCK",
});
}
}
VPC Link
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var config = new Config();
var name = config.RequireObject<dynamic>("name");
var subnetId = config.RequireObject<dynamic>("subnetId");
var testLoadBalancer = new Aws.LB.LoadBalancer("testLoadBalancer", new Aws.LB.LoadBalancerArgs
{
Internal = true,
LoadBalancerType = "network",
Subnets =
{
subnetId,
},
});
var testVpcLink = new Aws.ApiGateway.VpcLink("testVpcLink", new Aws.ApiGateway.VpcLinkArgs
{
TargetArn = testLoadBalancer.Arn,
});
var testRestApi = new Aws.ApiGateway.RestApi("testRestApi", new Aws.ApiGateway.RestApiArgs
{
});
var testResource = new Aws.ApiGateway.Resource("testResource", new Aws.ApiGateway.ResourceArgs
{
ParentId = testRestApi.RootResourceId,
PathPart = "test",
RestApi = testRestApi.Id,
});
var testMethod = new Aws.ApiGateway.Method("testMethod", new Aws.ApiGateway.MethodArgs
{
Authorization = "NONE",
HttpMethod = "GET",
RequestModels =
{
{ "application/json", "Error" },
},
ResourceId = testResource.Id,
RestApi = testRestApi.Id,
});
var testIntegration = new Aws.ApiGateway.Integration("testIntegration", new Aws.ApiGateway.IntegrationArgs
{
ConnectionId = testVpcLink.Id,
ConnectionType = "VPC_LINK",
ContentHandling = "CONVERT_TO_TEXT",
HttpMethod = testMethod.HttpMethod,
IntegrationHttpMethod = "GET",
PassthroughBehavior = "WHEN_NO_MATCH",
RequestParameters =
{
{ "integration.request.header.X-Authorization", "'static'" },
{ "integration.request.header.X-Foo", "'Bar'" },
},
RequestTemplates =
{
{ "application/json", "" },
{ "application/xml", @"#set($$inputRoot = $$input.path('$$'))
{ }
" },
},
ResourceId = testResource.Id,
RestApi = testRestApi.Id,
Type = "HTTP",
Uri = "https://www.google.de",
});
}
}
IntegrationArgs
IntegrationResponse
Provides an HTTP Method Integration Response for an API Gateway Resource.
Note: Depends on having
aws.apigateway.Integrationinside your rest api. To ensure this you might need to add an explicitdepends_onfor clean runs.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
{
Description = "This is my API for demonstration purposes",
});
var myDemoResource = new Aws.ApiGateway.Resource("myDemoResource", new Aws.ApiGateway.ResourceArgs
{
ParentId = myDemoAPI.RootResourceId,
PathPart = "mydemoresource",
RestApi = myDemoAPI.Id,
});
var myDemoMethod = new Aws.ApiGateway.Method("myDemoMethod", new Aws.ApiGateway.MethodArgs
{
Authorization = "NONE",
HttpMethod = "GET",
ResourceId = myDemoResource.Id,
RestApi = myDemoAPI.Id,
});
var myDemoIntegration = new Aws.ApiGateway.Integration("myDemoIntegration", new Aws.ApiGateway.IntegrationArgs
{
HttpMethod = myDemoMethod.HttpMethod,
ResourceId = myDemoResource.Id,
RestApi = myDemoAPI.Id,
Type = "MOCK",
});
var response200 = new Aws.ApiGateway.MethodResponse("response200", new Aws.ApiGateway.MethodResponseArgs
{
HttpMethod = myDemoMethod.HttpMethod,
ResourceId = myDemoResource.Id,
RestApi = myDemoAPI.Id,
StatusCode = "200",
});
var myDemoIntegrationResponse = new Aws.ApiGateway.IntegrationResponse("myDemoIntegrationResponse", new Aws.ApiGateway.IntegrationResponseArgs
{
HttpMethod = myDemoMethod.HttpMethod,
ResourceId = myDemoResource.Id,
ResponseTemplates =
{
{ "application/xml", @"#set($$inputRoot = $$input.path('$$'))
<?xml version=""1.0"" encoding=""UTF-8""?>
<message>
$$inputRoot.body
</message>
" },
},
RestApi = myDemoAPI.Id,
StatusCode = response200.StatusCode,
});
}
}
IntegrationResponseArgs
IntegrationResponseState
IntegrationState
Method
Provides a HTTP Method for an API Gateway Resource.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
{
Description = "This is my API for demonstration purposes",
});
var myDemoResource = new Aws.ApiGateway.Resource("myDemoResource", new Aws.ApiGateway.ResourceArgs
{
ParentId = myDemoAPI.RootResourceId,
PathPart = "mydemoresource",
RestApi = myDemoAPI.Id,
});
var myDemoMethod = new Aws.ApiGateway.Method("myDemoMethod", new Aws.ApiGateway.MethodArgs
{
Authorization = "NONE",
HttpMethod = "GET",
ResourceId = myDemoResource.Id,
RestApi = myDemoAPI.Id,
});
}
}
Usage with Cognito User Pool Authorizer
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var config = new Config();
var cognitoUserPoolName = config.RequireObject<dynamic>("cognitoUserPoolName");
var thisUserPools = Output.Create(Aws.Cognito.GetUserPools.InvokeAsync(new Aws.Cognito.GetUserPoolsArgs
{
Name = cognitoUserPoolName,
}));
var thisRestApi = new Aws.ApiGateway.RestApi("thisRestApi", new Aws.ApiGateway.RestApiArgs
{
});
var thisResource = new Aws.ApiGateway.Resource("thisResource", new Aws.ApiGateway.ResourceArgs
{
ParentId = thisRestApi.RootResourceId,
PathPart = "{proxy+}",
RestApi = thisRestApi.Id,
});
var thisAuthorizer = new Aws.ApiGateway.Authorizer("thisAuthorizer", new Aws.ApiGateway.AuthorizerArgs
{
ProviderArns = thisUserPools.Apply(thisUserPools => thisUserPools.Arns),
RestApi = thisRestApi.Id,
Type = "COGNITO_USER_POOLS",
});
var any = new Aws.ApiGateway.Method("any", new Aws.ApiGateway.MethodArgs
{
Authorization = "COGNITO_USER_POOLS",
AuthorizerId = thisAuthorizer.Id,
HttpMethod = "ANY",
RequestParameters =
{
{ "method.request.path.proxy", true },
},
ResourceId = thisResource.Id,
RestApi = thisRestApi.Id,
});
}
}
MethodArgs
MethodResponse
Provides an HTTP Method Response for an API Gateway Resource.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
{
Description = "This is my API for demonstration purposes",
});
var myDemoResource = new Aws.ApiGateway.Resource("myDemoResource", new Aws.ApiGateway.ResourceArgs
{
ParentId = myDemoAPI.RootResourceId,
PathPart = "mydemoresource",
RestApi = myDemoAPI.Id,
});
var myDemoMethod = new Aws.ApiGateway.Method("myDemoMethod", new Aws.ApiGateway.MethodArgs
{
Authorization = "NONE",
HttpMethod = "GET",
ResourceId = myDemoResource.Id,
RestApi = myDemoAPI.Id,
});
var myDemoIntegration = new Aws.ApiGateway.Integration("myDemoIntegration", new Aws.ApiGateway.IntegrationArgs
{
HttpMethod = myDemoMethod.HttpMethod,
ResourceId = myDemoResource.Id,
RestApi = myDemoAPI.Id,
Type = "MOCK",
});
var response200 = new Aws.ApiGateway.MethodResponse("response200", new Aws.ApiGateway.MethodResponseArgs
{
HttpMethod = myDemoMethod.HttpMethod,
ResourceId = myDemoResource.Id,
RestApi = myDemoAPI.Id,
StatusCode = "200",
});
}
}
MethodResponseArgs
MethodResponseState
MethodSettings
Provides an API Gateway Method Settings, e.g. logging or monitoring.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var testRestApi = new Aws.ApiGateway.RestApi("testRestApi", new Aws.ApiGateway.RestApiArgs
{
Description = "This is my API for demonstration purposes",
});
var testDeployment = new Aws.ApiGateway.Deployment("testDeployment", new Aws.ApiGateway.DeploymentArgs
{
RestApi = testRestApi.Id,
StageName = "dev",
});
var testStage = new Aws.ApiGateway.Stage("testStage", new Aws.ApiGateway.StageArgs
{
Deployment = testDeployment.Id,
RestApi = testRestApi.Id,
StageName = "prod",
});
var testResource = new Aws.ApiGateway.Resource("testResource", new Aws.ApiGateway.ResourceArgs
{
ParentId = testRestApi.RootResourceId,
PathPart = "mytestresource",
RestApi = testRestApi.Id,
});
var testMethod = new Aws.ApiGateway.Method("testMethod", new Aws.ApiGateway.MethodArgs
{
Authorization = "NONE",
HttpMethod = "GET",
ResourceId = testResource.Id,
RestApi = testRestApi.Id,
});
var methodSettings = new Aws.ApiGateway.MethodSettings("methodSettings", new Aws.ApiGateway.MethodSettingsArgs
{
MethodPath = Output.Tuple(testResource.PathPart, testMethod.HttpMethod).Apply(values =>
{
var pathPart = values.Item1;
var httpMethod = values.Item2;
return $"{pathPart}/{httpMethod}";
}),
RestApi = testRestApi.Id,
Settings = new Aws.ApiGateway.Inputs.MethodSettingsSettingsArgs
{
LoggingLevel = "INFO",
MetricsEnabled = true,
},
StageName = testStage.StageName,
});
var testIntegration = new Aws.ApiGateway.Integration("testIntegration", new Aws.ApiGateway.IntegrationArgs
{
HttpMethod = testMethod.HttpMethod,
RequestTemplates =
{
{ "application/xml", @"{
""body"" : $$input.json('$$')
}
" },
},
ResourceId = testResource.Id,
RestApi = testRestApi.Id,
Type = "MOCK",
});
}
}
MethodSettingsArgs
MethodSettingsState
MethodState
Model
Provides a Model for a REST API Gateway.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
{
Description = "This is my API for demonstration purposes",
});
var myDemoModel = new Aws.ApiGateway.Model("myDemoModel", new Aws.ApiGateway.ModelArgs
{
ContentType = "application/json",
Description = "a JSON schema",
RestApi = myDemoAPI.Id,
Schema = @"{
""type"": ""object""
}
",
});
}
}
ModelArgs
ModelState
RequestValidator
Manages an API Gateway Request Validator.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGateway.RequestValidator("example", new Aws.ApiGateway.RequestValidatorArgs
{
RestApi = aws_api_gateway_rest_api.Example.Id,
ValidateRequestBody = true,
ValidateRequestParameters = true,
});
}
}
RequestValidatorArgs
RequestValidatorState
Resource
Provides an API Gateway Resource.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
{
Description = "This is my API for demonstration purposes",
});
var myDemoResource = new Aws.ApiGateway.Resource("myDemoResource", new Aws.ApiGateway.ResourceArgs
{
ParentId = myDemoAPI.RootResourceId,
PathPart = "mydemoresource",
RestApi = myDemoAPI.Id,
});
}
}
ResourceArgs
ResourceState
Response
Provides an API Gateway Gateway Response for a REST API Gateway.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var main = new Aws.ApiGateway.RestApi("main", new Aws.ApiGateway.RestApiArgs
{
});
var test = new Aws.ApiGateway.Response("test", new Aws.ApiGateway.ResponseArgs
{
ResponseParameters =
{
{ "gatewayresponse.header.Authorization", "'Basic'" },
},
ResponseTemplates =
{
{ "application/json", "{'message':$$context.error.messageString}" },
},
ResponseType = "UNAUTHORIZED",
RestApiId = main.Id,
StatusCode = "401",
});
}
}
ResponseArgs
ResponseState
RestApi
Provides an API Gateway REST API.
Note: Amazon API Gateway Version 1 resources are used for creating and deploying REST APIs. To create and deploy WebSocket and HTTP APIs, use Amazon API Gateway Version 2.
Example Usage
Basic
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
{
Description = "This is my API for demonstration purposes",
});
}
}
Regional Endpoint Type
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGateway.RestApi("example", new Aws.ApiGateway.RestApiArgs
{
EndpointConfiguration = new Aws.ApiGateway.Inputs.RestApiEndpointConfigurationArgs
{
Types = "REGIONAL",
},
});
}
}
RestApiArgs
RestApiState
Stage
Provides an API Gateway Stage.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var testRestApi = new Aws.ApiGateway.RestApi("testRestApi", new Aws.ApiGateway.RestApiArgs
{
Description = "This is my API for demonstration purposes",
});
var testDeployment = new Aws.ApiGateway.Deployment("testDeployment", new Aws.ApiGateway.DeploymentArgs
{
RestApi = testRestApi.Id,
StageName = "dev",
});
var testStage = new Aws.ApiGateway.Stage("testStage", new Aws.ApiGateway.StageArgs
{
Deployment = testDeployment.Id,
RestApi = testRestApi.Id,
StageName = "prod",
});
var testResource = new Aws.ApiGateway.Resource("testResource", new Aws.ApiGateway.ResourceArgs
{
ParentId = testRestApi.RootResourceId,
PathPart = "mytestresource",
RestApi = testRestApi.Id,
});
var testMethod = new Aws.ApiGateway.Method("testMethod", new Aws.ApiGateway.MethodArgs
{
Authorization = "NONE",
HttpMethod = "GET",
ResourceId = testResource.Id,
RestApi = testRestApi.Id,
});
var methodSettings = new Aws.ApiGateway.MethodSettings("methodSettings", new Aws.ApiGateway.MethodSettingsArgs
{
MethodPath = Output.Tuple(testResource.PathPart, testMethod.HttpMethod).Apply(values =>
{
var pathPart = values.Item1;
var httpMethod = values.Item2;
return $"{pathPart}/{httpMethod}";
}),
RestApi = testRestApi.Id,
Settings = new Aws.ApiGateway.Inputs.MethodSettingsSettingsArgs
{
LoggingLevel = "INFO",
MetricsEnabled = true,
},
StageName = testStage.StageName,
});
var testIntegration = new Aws.ApiGateway.Integration("testIntegration", new Aws.ApiGateway.IntegrationArgs
{
HttpMethod = testMethod.HttpMethod,
ResourceId = testResource.Id,
RestApi = testRestApi.Id,
Type = "MOCK",
});
}
}
StageArgs
StageState
UsagePlan
Provides an API Gateway Usage Plan.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var myapi = new Aws.ApiGateway.RestApi("myapi", new Aws.ApiGateway.RestApiArgs
{
});
var dev = new Aws.ApiGateway.Deployment("dev", new Aws.ApiGateway.DeploymentArgs
{
RestApi = myapi.Id,
StageName = "dev",
});
var prod = new Aws.ApiGateway.Deployment("prod", new Aws.ApiGateway.DeploymentArgs
{
RestApi = myapi.Id,
StageName = "prod",
});
var myUsagePlan = new Aws.ApiGateway.UsagePlan("myUsagePlan", new Aws.ApiGateway.UsagePlanArgs
{
ApiStages =
{
new Aws.ApiGateway.Inputs.UsagePlanApiStageArgs
{
ApiId = myapi.Id,
Stage = dev.StageName,
},
new Aws.ApiGateway.Inputs.UsagePlanApiStageArgs
{
ApiId = myapi.Id,
Stage = prod.StageName,
},
},
Description = "my description",
ProductCode = "MYCODE",
QuotaSettings = new Aws.ApiGateway.Inputs.UsagePlanQuotaSettingsArgs
{
Limit = 20,
Offset = 2,
Period = "WEEK",
},
ThrottleSettings = new Aws.ApiGateway.Inputs.UsagePlanThrottleSettingsArgs
{
BurstLimit = 5,
RateLimit = 10,
},
});
}
}
UsagePlanArgs
UsagePlanKey
Provides an API Gateway Usage Plan Key.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var test = new Aws.ApiGateway.RestApi("test", new Aws.ApiGateway.RestApiArgs
{
});
var myusageplan = new Aws.ApiGateway.UsagePlan("myusageplan", new Aws.ApiGateway.UsagePlanArgs
{
ApiStages =
{
new Aws.ApiGateway.Inputs.UsagePlanApiStageArgs
{
ApiId = test.Id,
Stage = aws_api_gateway_deployment.Foo.Stage_name,
},
},
});
var mykey = new Aws.ApiGateway.ApiKey("mykey", new Aws.ApiGateway.ApiKeyArgs
{
});
var main = new Aws.ApiGateway.UsagePlanKey("main", new Aws.ApiGateway.UsagePlanKeyArgs
{
KeyId = mykey.Id,
KeyType = "API_KEY",
UsagePlanId = myusageplan.Id,
});
}
}
UsagePlanKeyArgs
UsagePlanKeyState
UsagePlanState
VpcLink
Provides an API Gateway VPC Link.
Note: Amazon API Gateway Version 1 VPC Links enable private integrations that connect REST APIs to private resources in a VPC. To enable private integration for HTTP APIs, use the Amazon API Gateway Version 2 VPC Link resource.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleLoadBalancer = new Aws.LB.LoadBalancer("exampleLoadBalancer", new Aws.LB.LoadBalancerArgs
{
Internal = true,
LoadBalancerType = "network",
SubnetMappings =
{
new Aws.LB.Inputs.LoadBalancerSubnetMappingArgs
{
SubnetId = "12345",
},
},
});
var exampleVpcLink = new Aws.ApiGateway.VpcLink("exampleVpcLink", new Aws.ApiGateway.VpcLinkArgs
{
Description = "example description",
TargetArn = exampleLoadBalancer.Arn,
});
}
}