Try AWS Native preview for resources not in the classic version.
aws.ec2.VpcEndpointPolicy
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
Provides a VPC Endpoint Policy resource.
Example Usage
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var exampleVpcEndpointService = Aws.Ec2.GetVpcEndpointService.Invoke(new()
{
Service = "dynamodb",
});
var exampleVpc = new Aws.Ec2.Vpc("exampleVpc", new()
{
CidrBlock = "10.0.0.0/16",
});
var exampleVpcEndpoint = new Aws.Ec2.VpcEndpoint("exampleVpcEndpoint", new()
{
ServiceName = exampleVpcEndpointService.Apply(getVpcEndpointServiceResult => getVpcEndpointServiceResult.ServiceName),
VpcId = exampleVpc.Id,
});
var exampleVpcEndpointPolicy = new Aws.Ec2.VpcEndpointPolicy("exampleVpcEndpointPolicy", new()
{
VpcEndpointId = exampleVpcEndpoint.Id,
Policy = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["Version"] = "2012-10-17",
["Statement"] = new[]
{
new Dictionary<string, object?>
{
["Sid"] = "AllowAll",
["Effect"] = "Allow",
["Principal"] = new Dictionary<string, object?>
{
["AWS"] = "*",
},
["Action"] = new[]
{
"dynamodb:*",
},
["Resource"] = "*",
},
},
}),
});
});
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleVpcEndpointService, err := ec2.LookupVpcEndpointService(ctx, &ec2.LookupVpcEndpointServiceArgs{
Service: pulumi.StringRef("dynamodb"),
}, nil)
if err != nil {
return err
}
exampleVpc, err := ec2.NewVpc(ctx, "exampleVpc", &ec2.VpcArgs{
CidrBlock: pulumi.String("10.0.0.0/16"),
})
if err != nil {
return err
}
exampleVpcEndpoint, err := ec2.NewVpcEndpoint(ctx, "exampleVpcEndpoint", &ec2.VpcEndpointArgs{
ServiceName: *pulumi.String(exampleVpcEndpointService.ServiceName),
VpcId: exampleVpc.ID(),
})
if err != nil {
return err
}
tmpJSON0, err := json.Marshal(map[string]interface{}{
"Version": "2012-10-17",
"Statement": []map[string]interface{}{
map[string]interface{}{
"Sid": "AllowAll",
"Effect": "Allow",
"Principal": map[string]interface{}{
"AWS": "*",
},
"Action": []string{
"dynamodb:*",
},
"Resource": "*",
},
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = ec2.NewVpcEndpointPolicy(ctx, "exampleVpcEndpointPolicy", &ec2.VpcEndpointPolicyArgs{
VpcEndpointId: exampleVpcEndpoint.ID(),
Policy: pulumi.String(json0),
})
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.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetVpcEndpointServiceArgs;
import com.pulumi.aws.ec2.Vpc;
import com.pulumi.aws.ec2.VpcArgs;
import com.pulumi.aws.ec2.VpcEndpoint;
import com.pulumi.aws.ec2.VpcEndpointArgs;
import com.pulumi.aws.ec2.VpcEndpointPolicy;
import com.pulumi.aws.ec2.VpcEndpointPolicyArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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) {
final var exampleVpcEndpointService = Ec2Functions.getVpcEndpointService(GetVpcEndpointServiceArgs.builder()
.service("dynamodb")
.build());
var exampleVpc = new Vpc("exampleVpc", VpcArgs.builder()
.cidrBlock("10.0.0.0/16")
.build());
var exampleVpcEndpoint = new VpcEndpoint("exampleVpcEndpoint", VpcEndpointArgs.builder()
.serviceName(exampleVpcEndpointService.applyValue(getVpcEndpointServiceResult -> getVpcEndpointServiceResult.serviceName()))
.vpcId(exampleVpc.id())
.build());
var exampleVpcEndpointPolicy = new VpcEndpointPolicy("exampleVpcEndpointPolicy", VpcEndpointPolicyArgs.builder()
.vpcEndpointId(exampleVpcEndpoint.id())
.policy(serializeJson(
jsonObject(
jsonProperty("Version", "2012-10-17"),
jsonProperty("Statement", jsonArray(jsonObject(
jsonProperty("Sid", "AllowAll"),
jsonProperty("Effect", "Allow"),
jsonProperty("Principal", jsonObject(
jsonProperty("AWS", "*")
)),
jsonProperty("Action", jsonArray("dynamodb:*")),
jsonProperty("Resource", "*")
)))
)))
.build());
}
}
import pulumi
import json
import pulumi_aws as aws
example_vpc_endpoint_service = aws.ec2.get_vpc_endpoint_service(service="dynamodb")
example_vpc = aws.ec2.Vpc("exampleVpc", cidr_block="10.0.0.0/16")
example_vpc_endpoint = aws.ec2.VpcEndpoint("exampleVpcEndpoint",
service_name=example_vpc_endpoint_service.service_name,
vpc_id=example_vpc.id)
example_vpc_endpoint_policy = aws.ec2.VpcEndpointPolicy("exampleVpcEndpointPolicy",
vpc_endpoint_id=example_vpc_endpoint.id,
policy=json.dumps({
"Version": "2012-10-17",
"Statement": [{
"Sid": "AllowAll",
"Effect": "Allow",
"Principal": {
"AWS": "*",
},
"Action": ["dynamodb:*"],
"Resource": "*",
}],
}))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const exampleVpcEndpointService = aws.ec2.getVpcEndpointService({
service: "dynamodb",
});
const exampleVpc = new aws.ec2.Vpc("exampleVpc", {cidrBlock: "10.0.0.0/16"});
const exampleVpcEndpoint = new aws.ec2.VpcEndpoint("exampleVpcEndpoint", {
serviceName: exampleVpcEndpointService.then(exampleVpcEndpointService => exampleVpcEndpointService.serviceName),
vpcId: exampleVpc.id,
});
const exampleVpcEndpointPolicy = new aws.ec2.VpcEndpointPolicy("exampleVpcEndpointPolicy", {
vpcEndpointId: exampleVpcEndpoint.id,
policy: JSON.stringify({
Version: "2012-10-17",
Statement: [{
Sid: "AllowAll",
Effect: "Allow",
Principal: {
AWS: "*",
},
Action: ["dynamodb:*"],
Resource: "*",
}],
}),
});
resources:
exampleVpc:
type: aws:ec2:Vpc
properties:
cidrBlock: 10.0.0.0/16
exampleVpcEndpoint:
type: aws:ec2:VpcEndpoint
properties:
serviceName: ${exampleVpcEndpointService.serviceName}
vpcId: ${exampleVpc.id}
exampleVpcEndpointPolicy:
type: aws:ec2:VpcEndpointPolicy
properties:
vpcEndpointId: ${exampleVpcEndpoint.id}
policy:
fn::toJSON:
Version: 2012-10-17
Statement:
- Sid: AllowAll
Effect: Allow
Principal:
AWS: '*'
Action:
- dynamodb:*
Resource: '*'
variables:
exampleVpcEndpointService:
fn::invoke:
Function: aws:ec2:getVpcEndpointService
Arguments:
service: dynamodb
Create VpcEndpointPolicy Resource
new VpcEndpointPolicy(name: string, args: VpcEndpointPolicyArgs, opts?: CustomResourceOptions);
@overload
def VpcEndpointPolicy(resource_name: str,
opts: Optional[ResourceOptions] = None,
policy: Optional[str] = None,
vpc_endpoint_id: Optional[str] = None)
@overload
def VpcEndpointPolicy(resource_name: str,
args: VpcEndpointPolicyArgs,
opts: Optional[ResourceOptions] = None)
func NewVpcEndpointPolicy(ctx *Context, name string, args VpcEndpointPolicyArgs, opts ...ResourceOption) (*VpcEndpointPolicy, error)
public VpcEndpointPolicy(string name, VpcEndpointPolicyArgs args, CustomResourceOptions? opts = null)
public VpcEndpointPolicy(String name, VpcEndpointPolicyArgs args)
public VpcEndpointPolicy(String name, VpcEndpointPolicyArgs args, CustomResourceOptions options)
type: aws:ec2:VpcEndpointPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args VpcEndpointPolicyArgs
- 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 VpcEndpointPolicyArgs
- 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 VpcEndpointPolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args VpcEndpointPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args VpcEndpointPolicyArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
VpcEndpointPolicy 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 VpcEndpointPolicy resource accepts the following input properties:
- Vpc
Endpoint stringId The VPC Endpoint ID.
- Policy string
A policy to attach to the endpoint that controls access to the service. Defaults to full access. All
Gateway
and someInterface
endpoints support policies - see the relevant AWS documentation for more details.
- Vpc
Endpoint stringId The VPC Endpoint ID.
- Policy string
A policy to attach to the endpoint that controls access to the service. Defaults to full access. All
Gateway
and someInterface
endpoints support policies - see the relevant AWS documentation for more details.
- vpc
Endpoint StringId The VPC Endpoint ID.
- policy String
A policy to attach to the endpoint that controls access to the service. Defaults to full access. All
Gateway
and someInterface
endpoints support policies - see the relevant AWS documentation for more details.
- vpc
Endpoint stringId The VPC Endpoint ID.
- policy string
A policy to attach to the endpoint that controls access to the service. Defaults to full access. All
Gateway
and someInterface
endpoints support policies - see the relevant AWS documentation for more details.
- vpc_
endpoint_ strid The VPC Endpoint ID.
- policy str
A policy to attach to the endpoint that controls access to the service. Defaults to full access. All
Gateway
and someInterface
endpoints support policies - see the relevant AWS documentation for more details.
- vpc
Endpoint StringId The VPC Endpoint ID.
- policy String
A policy to attach to the endpoint that controls access to the service. Defaults to full access. All
Gateway
and someInterface
endpoints support policies - see the relevant AWS documentation for more details.
Outputs
All input properties are implicitly available as output properties. Additionally, the VpcEndpointPolicy resource produces the following output properties:
- Id string
The provider-assigned unique ID for this managed resource.
- Id string
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
- id string
The provider-assigned unique ID for this managed resource.
- id str
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
Look up Existing VpcEndpointPolicy Resource
Get an existing VpcEndpointPolicy 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?: VpcEndpointPolicyState, opts?: CustomResourceOptions): VpcEndpointPolicy
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
policy: Optional[str] = None,
vpc_endpoint_id: Optional[str] = None) -> VpcEndpointPolicy
func GetVpcEndpointPolicy(ctx *Context, name string, id IDInput, state *VpcEndpointPolicyState, opts ...ResourceOption) (*VpcEndpointPolicy, error)
public static VpcEndpointPolicy Get(string name, Input<string> id, VpcEndpointPolicyState? state, CustomResourceOptions? opts = null)
public static VpcEndpointPolicy get(String name, Output<String> id, VpcEndpointPolicyState 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.
- Policy string
A policy to attach to the endpoint that controls access to the service. Defaults to full access. All
Gateway
and someInterface
endpoints support policies - see the relevant AWS documentation for more details.- Vpc
Endpoint stringId The VPC Endpoint ID.
- Policy string
A policy to attach to the endpoint that controls access to the service. Defaults to full access. All
Gateway
and someInterface
endpoints support policies - see the relevant AWS documentation for more details.- Vpc
Endpoint stringId The VPC Endpoint ID.
- policy String
A policy to attach to the endpoint that controls access to the service. Defaults to full access. All
Gateway
and someInterface
endpoints support policies - see the relevant AWS documentation for more details.- vpc
Endpoint StringId The VPC Endpoint ID.
- policy string
A policy to attach to the endpoint that controls access to the service. Defaults to full access. All
Gateway
and someInterface
endpoints support policies - see the relevant AWS documentation for more details.- vpc
Endpoint stringId The VPC Endpoint ID.
- policy str
A policy to attach to the endpoint that controls access to the service. Defaults to full access. All
Gateway
and someInterface
endpoints support policies - see the relevant AWS documentation for more details.- vpc_
endpoint_ strid The VPC Endpoint ID.
- policy String
A policy to attach to the endpoint that controls access to the service. Defaults to full access. All
Gateway
and someInterface
endpoints support policies - see the relevant AWS documentation for more details.- vpc
Endpoint StringId The VPC Endpoint ID.
Import
Using pulumi import
, import VPC Endpoint Policies using the id
. For example:
$ pulumi import aws:ec2/vpcEndpointPolicy:VpcEndpointPolicy example vpce-3ecf2a57
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.