Proxy class
Provides an RDS DB proxy resource. For additional information, see the RDS User Guide.
> Note: Not all Availability Zones (AZs) support DB proxies. Specifying vpcSubnetIds for AZs that do not support proxies will not trigger an error as long as at least one vpcSubnetId is valid. However, this will cause Terraform to continuously detect differences between the configuration and the actual infrastructure. Refer to the Unsupported Availability Zones section below for potential workarounds.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.rds.Proxy("example", {
auths: [{
authScheme: "SECRETS",
description: "example",
iamAuth: "DISABLED",
secretArn: exampleAwsSecretsmanagerSecret.arn,
}],
name: "example",
debugLogging: false,
engineFamily: "MYSQL",
idleClientTimeout: 1800,
requireTls: true,
roleArn: exampleAwsIamRole.arn,
vpcSecurityGroupIds: [exampleAwsSecurityGroup.id],
vpcSubnetIds: [exampleAwsSubnet.id],
tags: {
Name: "example",
Key: "value",
},
});
import pulumi
import pulumi_aws as aws
example = aws.rds.Proxy("example",
auths=[{
"auth_scheme": "SECRETS",
"description": "example",
"iam_auth": "DISABLED",
"secret_arn": example_aws_secretsmanager_secret["arn"],
}],
name="example",
debug_logging=False,
engine_family="MYSQL",
idle_client_timeout=1800,
require_tls=True,
role_arn=example_aws_iam_role["arn"],
vpc_security_group_ids=[example_aws_security_group["id"]],
vpc_subnet_ids=[example_aws_subnet["id"]],
tags={
"Name": "example",
"Key": "value",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Rds.Proxy("example", new()
{
Auths = new[]
{
new Aws.Rds.Inputs.ProxyAuthArgs
{
AuthScheme = "SECRETS",
Description = "example",
IamAuth = "DISABLED",
SecretArn = exampleAwsSecretsmanagerSecret.Arn,
},
},
Name = "example",
DebugLogging = false,
EngineFamily = "MYSQL",
IdleClientTimeout = 1800,
RequireTls = true,
RoleArn = exampleAwsIamRole.Arn,
VpcSecurityGroupIds = new[]
{
exampleAwsSecurityGroup.Id,
},
VpcSubnetIds = new[]
{
exampleAwsSubnet.Id,
},
Tags =
{
{ "Name", "example" },
{ "Key", "value" },
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/rds"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := rds.NewProxy(ctx, "example", &rds.ProxyArgs{
Auths: rds.ProxyAuthArray{
&rds.ProxyAuthArgs{
AuthScheme: pulumi.String("SECRETS"),
Description: pulumi.String("example"),
IamAuth: pulumi.String("DISABLED"),
SecretArn: pulumi.Any(exampleAwsSecretsmanagerSecret.Arn),
},
},
Name: pulumi.String("example"),
DebugLogging: pulumi.Bool(false),
EngineFamily: pulumi.String("MYSQL"),
IdleClientTimeout: pulumi.Int(1800),
RequireTls: pulumi.Bool(true),
RoleArn: pulumi.Any(exampleAwsIamRole.Arn),
VpcSecurityGroupIds: pulumi.StringArray{
exampleAwsSecurityGroup.Id,
},
VpcSubnetIds: pulumi.StringArray{
exampleAwsSubnet.Id,
},
Tags: pulumi.StringMap{
"Name": pulumi.String("example"),
"Key": pulumi.String("value"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_rds_proxy" "example" {
auths {
auth_scheme = "SECRETS"
description = "example"
iam_auth = "DISABLED"
secret_arn = exampleAwsSecretsmanagerSecret.arn
}
name = "example"
debug_logging = false
engine_family = "MYSQL"
idle_client_timeout = 1800
require_tls = true
role_arn = exampleAwsIamRole.arn
vpc_security_group_ids = [exampleAwsSecurityGroup.id]
vpc_subnet_ids = [exampleAwsSubnet.id]
tags = {
"Name" = "example"
"Key" = "value"
}
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.rds.Proxy;
import com.pulumi.aws.rds.ProxyArgs;
import com.pulumi.aws.rds.inputs.ProxyAuthArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 example = new Proxy("example", ProxyArgs.builder()
.auths(ProxyAuthArgs.builder()
.authScheme("SECRETS")
.description("example")
.iamAuth("DISABLED")
.secretArn(exampleAwsSecretsmanagerSecret.arn())
.build())
.name("example")
.debugLogging(false)
.engineFamily("MYSQL")
.idleClientTimeout(1800)
.requireTls(true)
.roleArn(exampleAwsIamRole.arn())
.vpcSecurityGroupIds(exampleAwsSecurityGroup.id())
.vpcSubnetIds(exampleAwsSubnet.id())
.tags(Map.ofEntries(
Map.entry("Name", "example"),
Map.entry("Key", "value")
))
.build());
}
}
resources:
example:
type: aws:rds:Proxy
properties:
auths:
- authScheme: SECRETS
description: example
iamAuth: DISABLED
secretArn: ${exampleAwsSecretsmanagerSecret.arn}
name: example
debugLogging: false
engineFamily: MYSQL
idleClientTimeout: 1800
requireTls: true
roleArn: ${exampleAwsIamRole.arn}
vpcSecurityGroupIds:
- ${exampleAwsSecurityGroup.id}
vpcSubnetIds:
- ${exampleAwsSubnet.id}
tags:
Name: example
Key: value
Unsupported Availability Zones
Terraform may report constant differences if you use vpcSubnetIds that correspond to Availability Zones (AZs) that do not support a DB proxy. While this typically does not result in an error, AWS only returns vpcSubnetIds for AZs that support DB proxies. As a result, Terraform detects a mismatch between your configuration and the actual infrastructure, leading it to report that changes are required. Below are some ways to avoid this issue.
One solution is to exclude AZs that do not support DB proxies by using the aws.getAvailabilityZones data source. The example below demonstrates how to configure this for the us-east-1 region, excluding the use1-az3 AZ. (Keep in mind that AZ names can vary between accounts, while AZ IDs remain consistent.) If the us-east-1 region has six AZs in total and you aim to configure the maximum number of subnets, you would exclude one AZ and configure five subnets:
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as std from "@pulumi/std";
const available = aws.getAvailabilityZones({
filters: [{
name: "opt-in-status",
values: ["opt-in-not-required"],
}],
excludeZoneIds: ["use1-az3"],
state: "available",
});
const example = new aws.ec2.Vpc("example", {cidrBlock: "10.0.0.0/16"});
const exampleSubnet: aws.ec2.Subnet[] = [];
for (let range = 0; range < 5; range++) {
exampleSubnet.push(new aws.ec2.Subnet(`example-${range}`, {
cidrBlock: std.cidrsubnetOutput({
input: example.cidrBlock,
newbits: 8,
netnum: range,
}).result,
availabilityZone: available.then(available => available.names[range]),
vpcId: example.id,
}));
}
const exampleProxy = new aws.rds.Proxy("example", {
name: "example",
vpcSubnetIds: [exampleSubnet.id],
});
import pulumi
from typing import Any
import pulumi_aws as aws
import pulumi_std as std
available = aws.get_availability_zones(filters=[{
"name": "opt-in-status",
"values": ["opt-in-not-required"],
}],
exclude_zone_ids=["use1-az3"],
state="available")
example = aws.ec2.Vpc("example", cidr_block="10.0.0.0/16")
example_subnet: list[aws.ec2.Subnet] = []
for example_subnet_range in [{"value": i} for i in range(0, 5)]:
example_subnet.append(aws.ec2.Subnet(f"example-{example_subnet_range['value']}",
cidr_block=std.cidrsubnet_output(input=example.cidr_block,
newbits=8,
netnum=example_subnet_range["value"]).result,
availability_zone=available.names[example_subnet_range["value"]],
vpc_id=example.id))
example_proxy = aws.rds.Proxy("example",
name="example",
vpc_subnet_ids=[example_subnet.id])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
var available = Aws.GetAvailabilityZones.Invoke(new()
{
Filters = new[]
{
new Aws.Inputs.GetAvailabilityZonesFilterInputArgs
{
Name = "opt-in-status",
Values = new[]
{
"opt-in-not-required",
},
},
},
ExcludeZoneIds = new[]
{
"use1-az3",
},
State = "available",
});
var example = new Aws.Ec2.Vpc("example", new()
{
CidrBlock = "10.0.0.0/16",
});
var exampleSubnet = new List<Aws.Ec2.Subnet>();
for (var rangeIndex = 0; rangeIndex < 5; rangeIndex++)
{
var range = new { Value = rangeIndex };
exampleSubnet.Add(new Aws.Ec2.Subnet($"example-{range.Value}", new()
{
CidrBlock = Std.Cidrsubnet.Invoke(new()
{
Input = example.CidrBlock,
Newbits = 8,
Netnum = range.Value,
}).Apply(invoke => invoke.Result),
AvailabilityZone = available.Apply(getAvailabilityZonesResult => getAvailabilityZonesResult.Names)[range.Value],
VpcId = example.Id,
}));
}
var exampleProxy = new Aws.Rds.Proxy("example", new()
{
Name = "example",
VpcSubnetIds = new[]
{
exampleSubnet.Id,
},
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/rds"
"github.com/pulumi/pulumi-std/sdk/go/std"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
available, err := aws.GetAvailabilityZones(ctx, &aws.GetAvailabilityZonesArgs{
Filters: []aws.GetAvailabilityZonesFilter{
{
Name: "opt-in-status",
Values: []string{
"opt-in-not-required",
},
},
},
ExcludeZoneIds: []string{
"use1-az3",
},
State: pulumi.StringRef("available"),
}, nil)
if err != nil {
return err
}
example, err := ec2.NewVpc(ctx, "example", &ec2.VpcArgs{
CidrBlock: pulumi.String("10.0.0.0/16"),
})
if err != nil {
return err
}
var exampleSubnet []*ec2.Subnet
for index := 0; index < 5; index++ {
key0 := index
val0 := index
__res, err := ec2.NewSubnet(ctx, fmt.Sprintf("example-%v", key0), &ec2.SubnetArgs{
CidrBlock: std.CidrsubnetOutput(ctx, std.CidrsubnetOutputArgs{
Input: example.CidrBlock,
Newbits: pulumi.Int(8),
Netnum: pulumi.Int(val0),
}, nil).Result(),
AvailabilityZone: pulumi.String(available.Names[val0]),
VpcId: example.ID().ToIDOutput().ToStringOutput(),
})
if err != nil {
return err
}
exampleSubnet = append(exampleSubnet, __res)
}
_, err = rds.NewProxy(ctx, "example", &rds.ProxyArgs{
Name: pulumi.String("example"),
VpcSubnetIds: pulumi.StringArray{
exampleSubnet.ID(),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
std = {
source = "pulumi/std"
}
}
}
data "aws_getavailabilityzones" "available" {
filters {
name = "opt-in-status"
values = ["opt-in-not-required"]
}
exclude_zone_ids = ["use1-az3"]
state = "available"
}
resource "aws_ec2_vpc" "example" {
cidr_block = "10.0.0.0/16"
}
resource "aws_ec2_subnet" "example" {
count = 5
cidr_block = cidrsubnet(aws_ec2_vpc.example.cidr_block, 8, count.index)
availability_zone = data.aws_getavailabilityzones.available.names[count.index]
vpc_id = aws_ec2_vpc.example.id
}
resource "aws_rds_proxy" "example" {
name = "example"
vpc_subnet_ids = [aws_ec2_subnet.example.id]
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetAvailabilityZonesArgs;
import com.pulumi.aws.inputs.GetAvailabilityZonesFilterArgs;
import com.pulumi.aws.ec2.Vpc;
import com.pulumi.aws.ec2.VpcArgs;
import com.pulumi.aws.ec2.Subnet;
import com.pulumi.aws.ec2.SubnetArgs;
import com.pulumi.std.StdFunctions;
import com.pulumi.std.inputs.CidrsubnetArgs;
import com.pulumi.aws.rds.Proxy;
import com.pulumi.aws.rds.ProxyArgs;
import com.pulumi.codegen.internal.KeyedValue;
import java.util.ArrayList;
import java.util.Arrays;
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) {
final var available = AwsFunctions.getAvailabilityZones(GetAvailabilityZonesArgs.builder()
.filters(GetAvailabilityZonesFilterArgs.builder()
.name("opt-in-status")
.values("opt-in-not-required")
.build())
.excludeZoneIds("use1-az3")
.state("available")
.build());
var example = new Vpc("example", VpcArgs.builder()
.cidrBlock("10.0.0.0/16")
.build());
for (var i = 0; i < 5; i++) {
new Subnet("exampleSubnet-" + i, SubnetArgs.builder()
.cidrBlock(StdFunctions.cidrsubnet(CidrsubnetArgs.builder()
.input(example.cidrBlock())
.newbits(8)
.netnum(range.value())
.build()).applyValue(_invoke -> _invoke.result()))
.availabilityZone(available.names()[range.value()])
.vpcId(example.id())
.build());
}
var exampleProxy = new Proxy("exampleProxy", ProxyArgs.builder()
.name("example")
.vpcSubnetIds(exampleSubnet.id())
.build());
}
}
Another approach is to use the lifecycle ignoreChanges meta-argument. With this method, Terraform will stop detecting differences for the vpcSubnetIds argument. However, note that this approach disables Terraform's ability to track and manage updates to vpcSubnetIds, so use it carefully to avoid unintended drift between your configuration and the actual infrastructure.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.rds.Proxy("example", {
name: "example",
vpcSubnetIds: [exampleAwsSubnet.id],
}, {
ignoreChanges: ["vpcSubnetIds"],
});
import pulumi
import pulumi_aws as aws
example = aws.rds.Proxy("example",
name="example",
vpc_subnet_ids=[example_aws_subnet["id"]],
opts = pulumi.ResourceOptions(ignore_changes=["vpcSubnetIds"]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Rds.Proxy("example", new()
{
Name = "example",
VpcSubnetIds = new[]
{
exampleAwsSubnet.Id,
},
}, new CustomResourceOptions
{
IgnoreChanges =
{
"vpcSubnetIds",
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/rds"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := rds.NewProxy(ctx, "example", &rds.ProxyArgs{
Name: pulumi.String("example"),
VpcSubnetIds: pulumi.StringArray{
exampleAwsSubnet.Id,
},
}, pulumi.IgnoreChanges([]string{
"vpcSubnetIds",
}))
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_rds_proxy" "example" {
lifecycle {
ignore_changes = [vpcSubnetIds]
}
name = "example"
vpc_subnet_ids = [exampleAwsSubnet.id]
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.rds.Proxy;
import com.pulumi.aws.rds.ProxyArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.ArrayList;
import java.util.Arrays;
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 example = new Proxy("example", ProxyArgs.builder()
.name("example")
.vpcSubnetIds(exampleAwsSubnet.id())
.build(), CustomResourceOptions.builder()
.ignoreChanges("vpcSubnetIds")
.build());
}
}
resources:
example:
type: aws:rds:Proxy
properties:
name: example
vpcSubnetIds:
- ${exampleAwsSubnet.id}
options:
ignoreChanges:
- vpcSubnetIds
Import
Using pulumi import, import DB proxies using the name. For example:
$ pulumi import aws:rds/proxy:Proxy example example
Constructors
- Proxy(String name, {ProxyArgs? args, CustomResourceOptions? options})
-
Creates a new Proxy.
nameThe Pulumi resource name.argsArguments used to configure this Proxy. The set of arguments for Proxy.optionsResource options controlling this resource's behavior. - Proxy.reference(String urn)
- Creates a typed reference to an existing Proxy resource.
Properties
-
arn
↔ Output<
String> -
ARN for the proxy.
latefinal
-
auths
↔ Output<
List< ProxyAuth> ?> -
Configuration block(s) with authorization mechanisms to connect to the associated instances or clusters. Required when
defaultAuthSchemeisNONEor unspecified. See theauthblock below.latefinal -
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
debugLogging
↔ Output<
bool?> -
Whether the proxy includes detailed information about SQL statements in its logs. This information helps you to debug issues involving SQL behavior or the performance and scalability of the proxy connections. The debug information includes the text of SQL statements that you submit through the proxy. Thus, only enable this setting when needed for debugging, and only when you have security measures in place to safeguard any sensitive information that appears in the logs.
latefinal
-
defaultAuthScheme
↔ Output<
String> -
Default authentication scheme that the proxy uses for client connections to the proxy and connections from the proxy to the underlying database. Valid values are
NONEandIAM_AUTH. Defaults toNONE.latefinal -
endpoint
↔ Output<
String> -
Endpoint that you can use to connect to the proxy. You include the endpoint value in the connection string for a database client application.
latefinal
-
endpointNetworkType
↔ Output<
String> -
Network type of the DB proxy endpoint. Valid values are
IPV4,IPV6andDUAL. Defaults toIPV4. IfIPV6is specified, the subnets associated with the proxy must be IPv6-only, andtargetConnectionNetworkTypemust beIPV6.latefinal -
engineFamily
↔ Output<
String> -
Kinds of databases that the proxy can connect to. This value determines which database network protocol the proxy recognizes when it interprets network traffic to and from the database. For Aurora MySQL, RDS for MariaDB, and RDS for MySQL databases, specify
MYSQL. For Aurora PostgreSQL and RDS for PostgreSQL databases, specifyPOSTGRESQL. For RDS for Microsoft SQL Server, specifySQLSERVER. Valid values areMYSQL,POSTGRESQL, andSQLSERVER.latefinal - hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
-
idleClientTimeout
↔ Output<
int> -
Number of seconds that a connection to the proxy can be inactive before the proxy disconnects it. You can set this value higher or lower than the connection timeout limit for the associated database.
latefinal
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
name
↔ Output<
String> -
Identifier for the proxy. This name must be unique for all proxies owned by your AWS account in the specified AWS Region. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive hyphens.
latefinal
-
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
requireTls
↔ Output<
bool?> -
Whether TLS encryption is required for connections to the proxy. Enabling this setting enforces encrypted TLS connections to the proxy.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
-
roleArn
↔ Output<
String> -
ARN of the IAM role that the proxy uses to access secrets in AWS Secrets Manager.
latefinal
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
Map of tags to assign to the resource. If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
Map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
targetConnectionNetworkType
↔ Output<
String> -
Network type that the proxy uses to connect to the target database. Valid values are
IPV4andIPV6. Defaults toIPV4.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
-
vpcSecurityGroupIds
↔ Output<
List< String> > -
One or more VPC security group IDs to associate with the new proxy.
latefinal
-
vpcSubnetIds
↔ Output<
List< String> > -
One or more VPC subnet IDs to associate with the new proxy.
latefinal
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited