aws logo
AWS Classic v5.41.0, May 15 23

aws.s3control.ObjectLambdaAccessPointPolicy

Explore with Pulumi AI

Provides a resource to manage an S3 Object Lambda Access Point resource policy.

Example Usage

using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var exampleBucketV2 = new Aws.S3.BucketV2("exampleBucketV2");

    var exampleAccessPoint = new Aws.S3.AccessPoint("exampleAccessPoint", new()
    {
        Bucket = exampleBucketV2.Id,
    });

    var exampleObjectLambdaAccessPoint = new Aws.S3Control.ObjectLambdaAccessPoint("exampleObjectLambdaAccessPoint", new()
    {
        Configuration = new Aws.S3Control.Inputs.ObjectLambdaAccessPointConfigurationArgs
        {
            SupportingAccessPoint = exampleAccessPoint.Arn,
            TransformationConfigurations = new[]
            {
                new Aws.S3Control.Inputs.ObjectLambdaAccessPointConfigurationTransformationConfigurationArgs
                {
                    Actions = new[]
                    {
                        "GetObject",
                    },
                    ContentTransformation = new Aws.S3Control.Inputs.ObjectLambdaAccessPointConfigurationTransformationConfigurationContentTransformationArgs
                    {
                        AwsLambda = new Aws.S3Control.Inputs.ObjectLambdaAccessPointConfigurationTransformationConfigurationContentTransformationAwsLambdaArgs
                        {
                            FunctionArn = aws_lambda_function.Example.Arn,
                        },
                    },
                },
            },
        },
    });

    var exampleObjectLambdaAccessPointPolicy = new Aws.S3Control.ObjectLambdaAccessPointPolicy("exampleObjectLambdaAccessPointPolicy", new()
    {
        Policy = exampleObjectLambdaAccessPoint.Arn.Apply(arn => JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["Version"] = "2008-10-17",
            ["Statement"] = new[]
            {
                new Dictionary<string, object?>
                {
                    ["Effect"] = "Allow",
                    ["Action"] = "s3-object-lambda:GetObject",
                    ["Principal"] = new Dictionary<string, object?>
                    {
                        ["AWS"] = data.Aws_caller_identity.Current.Account_id,
                    },
                    ["Resource"] = arn,
                },
            },
        })),
    });

});
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3control"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleBucketV2, err := s3.NewBucketV2(ctx, "exampleBucketV2", nil)
		if err != nil {
			return err
		}
		exampleAccessPoint, err := s3.NewAccessPoint(ctx, "exampleAccessPoint", &s3.AccessPointArgs{
			Bucket: exampleBucketV2.ID(),
		})
		if err != nil {
			return err
		}
		exampleObjectLambdaAccessPoint, err := s3control.NewObjectLambdaAccessPoint(ctx, "exampleObjectLambdaAccessPoint", &s3control.ObjectLambdaAccessPointArgs{
			Configuration: &s3control.ObjectLambdaAccessPointConfigurationArgs{
				SupportingAccessPoint: exampleAccessPoint.Arn,
				TransformationConfigurations: s3control.ObjectLambdaAccessPointConfigurationTransformationConfigurationArray{
					&s3control.ObjectLambdaAccessPointConfigurationTransformationConfigurationArgs{
						Actions: pulumi.StringArray{
							pulumi.String("GetObject"),
						},
						ContentTransformation: &s3control.ObjectLambdaAccessPointConfigurationTransformationConfigurationContentTransformationArgs{
							AwsLambda: &s3control.ObjectLambdaAccessPointConfigurationTransformationConfigurationContentTransformationAwsLambdaArgs{
								FunctionArn: pulumi.Any(aws_lambda_function.Example.Arn),
							},
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = s3control.NewObjectLambdaAccessPointPolicy(ctx, "exampleObjectLambdaAccessPointPolicy", &s3control.ObjectLambdaAccessPointPolicyArgs{
			Policy: exampleObjectLambdaAccessPoint.Arn.ApplyT(func(arn string) (pulumi.String, error) {
				var _zero pulumi.String
				tmpJSON0, err := json.Marshal(map[string]interface{}{
					"Version": "2008-10-17",
					"Statement": []map[string]interface{}{
						map[string]interface{}{
							"Effect": "Allow",
							"Action": "s3-object-lambda:GetObject",
							"Principal": map[string]interface{}{
								"AWS": data.Aws_caller_identity.Current.Account_id,
							},
							"Resource": arn,
						},
					},
				})
				if err != nil {
					return _zero, err
				}
				json0 := string(tmpJSON0)
				return pulumi.String(json0), nil
			}).(pulumi.StringOutput),
		})
		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.s3.BucketV2;
import com.pulumi.aws.s3.AccessPoint;
import com.pulumi.aws.s3.AccessPointArgs;
import com.pulumi.aws.s3control.ObjectLambdaAccessPoint;
import com.pulumi.aws.s3control.ObjectLambdaAccessPointArgs;
import com.pulumi.aws.s3control.inputs.ObjectLambdaAccessPointConfigurationArgs;
import com.pulumi.aws.s3control.ObjectLambdaAccessPointPolicy;
import com.pulumi.aws.s3control.ObjectLambdaAccessPointPolicyArgs;
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) {
        var exampleBucketV2 = new BucketV2("exampleBucketV2");

        var exampleAccessPoint = new AccessPoint("exampleAccessPoint", AccessPointArgs.builder()        
            .bucket(exampleBucketV2.id())
            .build());

        var exampleObjectLambdaAccessPoint = new ObjectLambdaAccessPoint("exampleObjectLambdaAccessPoint", ObjectLambdaAccessPointArgs.builder()        
            .configuration(ObjectLambdaAccessPointConfigurationArgs.builder()
                .supportingAccessPoint(exampleAccessPoint.arn())
                .transformationConfigurations(ObjectLambdaAccessPointConfigurationTransformationConfigurationArgs.builder()
                    .actions("GetObject")
                    .contentTransformation(ObjectLambdaAccessPointConfigurationTransformationConfigurationContentTransformationArgs.builder()
                        .awsLambda(ObjectLambdaAccessPointConfigurationTransformationConfigurationContentTransformationAwsLambdaArgs.builder()
                            .functionArn(aws_lambda_function.example().arn())
                            .build())
                        .build())
                    .build())
                .build())
            .build());

        var exampleObjectLambdaAccessPointPolicy = new ObjectLambdaAccessPointPolicy("exampleObjectLambdaAccessPointPolicy", ObjectLambdaAccessPointPolicyArgs.builder()        
            .policy(exampleObjectLambdaAccessPoint.arn().applyValue(arn -> serializeJson(
                jsonObject(
                    jsonProperty("Version", "2008-10-17"),
                    jsonProperty("Statement", jsonArray(jsonObject(
                        jsonProperty("Effect", "Allow"),
                        jsonProperty("Action", "s3-object-lambda:GetObject"),
                        jsonProperty("Principal", jsonObject(
                            jsonProperty("AWS", data.aws_caller_identity().current().account_id())
                        )),
                        jsonProperty("Resource", arn)
                    )))
                ))))
            .build());

    }
}
import pulumi
import json
import pulumi_aws as aws

example_bucket_v2 = aws.s3.BucketV2("exampleBucketV2")
example_access_point = aws.s3.AccessPoint("exampleAccessPoint", bucket=example_bucket_v2.id)
example_object_lambda_access_point = aws.s3control.ObjectLambdaAccessPoint("exampleObjectLambdaAccessPoint", configuration=aws.s3control.ObjectLambdaAccessPointConfigurationArgs(
    supporting_access_point=example_access_point.arn,
    transformation_configurations=[aws.s3control.ObjectLambdaAccessPointConfigurationTransformationConfigurationArgs(
        actions=["GetObject"],
        content_transformation=aws.s3control.ObjectLambdaAccessPointConfigurationTransformationConfigurationContentTransformationArgs(
            aws_lambda=aws.s3control.ObjectLambdaAccessPointConfigurationTransformationConfigurationContentTransformationAwsLambdaArgs(
                function_arn=aws_lambda_function["example"]["arn"],
            ),
        ),
    )],
))
example_object_lambda_access_point_policy = aws.s3control.ObjectLambdaAccessPointPolicy("exampleObjectLambdaAccessPointPolicy", policy=example_object_lambda_access_point.arn.apply(lambda arn: json.dumps({
    "Version": "2008-10-17",
    "Statement": [{
        "Effect": "Allow",
        "Action": "s3-object-lambda:GetObject",
        "Principal": {
            "AWS": data["aws_caller_identity"]["current"]["account_id"],
        },
        "Resource": arn,
    }],
})))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const exampleBucketV2 = new aws.s3.BucketV2("exampleBucketV2", {});
const exampleAccessPoint = new aws.s3.AccessPoint("exampleAccessPoint", {bucket: exampleBucketV2.id});
const exampleObjectLambdaAccessPoint = new aws.s3control.ObjectLambdaAccessPoint("exampleObjectLambdaAccessPoint", {configuration: {
    supportingAccessPoint: exampleAccessPoint.arn,
    transformationConfigurations: [{
        actions: ["GetObject"],
        contentTransformation: {
            awsLambda: {
                functionArn: aws_lambda_function.example.arn,
            },
        },
    }],
}});
const exampleObjectLambdaAccessPointPolicy = new aws.s3control.ObjectLambdaAccessPointPolicy("exampleObjectLambdaAccessPointPolicy", {policy: exampleObjectLambdaAccessPoint.arn.apply(arn => JSON.stringify({
    Version: "2008-10-17",
    Statement: [{
        Effect: "Allow",
        Action: "s3-object-lambda:GetObject",
        Principal: {
            AWS: data.aws_caller_identity.current.account_id,
        },
        Resource: arn,
    }],
}))});
resources:
  exampleBucketV2:
    type: aws:s3:BucketV2
  exampleAccessPoint:
    type: aws:s3:AccessPoint
    properties:
      bucket: ${exampleBucketV2.id}
  exampleObjectLambdaAccessPoint:
    type: aws:s3control:ObjectLambdaAccessPoint
    properties:
      configuration:
        supportingAccessPoint: ${exampleAccessPoint.arn}
        transformationConfigurations:
          - actions:
              - GetObject
            contentTransformation:
              awsLambda:
                functionArn: ${aws_lambda_function.example.arn}
  exampleObjectLambdaAccessPointPolicy:
    type: aws:s3control:ObjectLambdaAccessPointPolicy
    properties:
      policy:
        fn::toJSON:
          Version: 2008-10-17
          Statement:
            - Effect: Allow
              Action: s3-object-lambda:GetObject
              Principal:
                AWS: ${data.aws_caller_identity.current.account_id}
              Resource: ${exampleObjectLambdaAccessPoint.arn}

Create ObjectLambdaAccessPointPolicy Resource

new ObjectLambdaAccessPointPolicy(name: string, args: ObjectLambdaAccessPointPolicyArgs, opts?: CustomResourceOptions);
@overload
def ObjectLambdaAccessPointPolicy(resource_name: str,
                                  opts: Optional[ResourceOptions] = None,
                                  account_id: Optional[str] = None,
                                  name: Optional[str] = None,
                                  policy: Optional[str] = None)
@overload
def ObjectLambdaAccessPointPolicy(resource_name: str,
                                  args: ObjectLambdaAccessPointPolicyArgs,
                                  opts: Optional[ResourceOptions] = None)
func NewObjectLambdaAccessPointPolicy(ctx *Context, name string, args ObjectLambdaAccessPointPolicyArgs, opts ...ResourceOption) (*ObjectLambdaAccessPointPolicy, error)
public ObjectLambdaAccessPointPolicy(string name, ObjectLambdaAccessPointPolicyArgs args, CustomResourceOptions? opts = null)
public ObjectLambdaAccessPointPolicy(String name, ObjectLambdaAccessPointPolicyArgs args)
public ObjectLambdaAccessPointPolicy(String name, ObjectLambdaAccessPointPolicyArgs args, CustomResourceOptions options)
type: aws:s3control:ObjectLambdaAccessPointPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ObjectLambdaAccessPointPolicyArgs
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 ObjectLambdaAccessPointPolicyArgs
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 ObjectLambdaAccessPointPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ObjectLambdaAccessPointPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ObjectLambdaAccessPointPolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

ObjectLambdaAccessPointPolicy 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 ObjectLambdaAccessPointPolicy resource accepts the following input properties:

Policy string

The Object Lambda Access Point resource policy document.

AccountId string

The AWS account ID for the account that owns the Object Lambda Access Point. Defaults to automatically determined account ID of the AWS provider.

Name string

The name of the Object Lambda Access Point.

Policy string

The Object Lambda Access Point resource policy document.

AccountId string

The AWS account ID for the account that owns the Object Lambda Access Point. Defaults to automatically determined account ID of the AWS provider.

Name string

The name of the Object Lambda Access Point.

policy String

The Object Lambda Access Point resource policy document.

accountId String

The AWS account ID for the account that owns the Object Lambda Access Point. Defaults to automatically determined account ID of the AWS provider.

name String

The name of the Object Lambda Access Point.

policy string

The Object Lambda Access Point resource policy document.

accountId string

The AWS account ID for the account that owns the Object Lambda Access Point. Defaults to automatically determined account ID of the AWS provider.

name string

The name of the Object Lambda Access Point.

policy str

The Object Lambda Access Point resource policy document.

account_id str

The AWS account ID for the account that owns the Object Lambda Access Point. Defaults to automatically determined account ID of the AWS provider.

name str

The name of the Object Lambda Access Point.

policy String

The Object Lambda Access Point resource policy document.

accountId String

The AWS account ID for the account that owns the Object Lambda Access Point. Defaults to automatically determined account ID of the AWS provider.

name String

The name of the Object Lambda Access Point.

Outputs

All input properties are implicitly available as output properties. Additionally, the ObjectLambdaAccessPointPolicy resource produces the following output properties:

HasPublicAccessPolicy bool

Indicates whether this access point currently has a policy that allows public access.

Id string

The provider-assigned unique ID for this managed resource.

HasPublicAccessPolicy bool

Indicates whether this access point currently has a policy that allows public access.

Id string

The provider-assigned unique ID for this managed resource.

hasPublicAccessPolicy Boolean

Indicates whether this access point currently has a policy that allows public access.

id String

The provider-assigned unique ID for this managed resource.

hasPublicAccessPolicy boolean

Indicates whether this access point currently has a policy that allows public access.

id string

The provider-assigned unique ID for this managed resource.

has_public_access_policy bool

Indicates whether this access point currently has a policy that allows public access.

id str

The provider-assigned unique ID for this managed resource.

hasPublicAccessPolicy Boolean

Indicates whether this access point currently has a policy that allows public access.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing ObjectLambdaAccessPointPolicy Resource

Get an existing ObjectLambdaAccessPointPolicy 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?: ObjectLambdaAccessPointPolicyState, opts?: CustomResourceOptions): ObjectLambdaAccessPointPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_id: Optional[str] = None,
        has_public_access_policy: Optional[bool] = None,
        name: Optional[str] = None,
        policy: Optional[str] = None) -> ObjectLambdaAccessPointPolicy
func GetObjectLambdaAccessPointPolicy(ctx *Context, name string, id IDInput, state *ObjectLambdaAccessPointPolicyState, opts ...ResourceOption) (*ObjectLambdaAccessPointPolicy, error)
public static ObjectLambdaAccessPointPolicy Get(string name, Input<string> id, ObjectLambdaAccessPointPolicyState? state, CustomResourceOptions? opts = null)
public static ObjectLambdaAccessPointPolicy get(String name, Output<String> id, ObjectLambdaAccessPointPolicyState 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.
The following state arguments are supported:
AccountId string

The AWS account ID for the account that owns the Object Lambda Access Point. Defaults to automatically determined account ID of the AWS provider.

HasPublicAccessPolicy bool

Indicates whether this access point currently has a policy that allows public access.

Name string

The name of the Object Lambda Access Point.

Policy string

The Object Lambda Access Point resource policy document.

AccountId string

The AWS account ID for the account that owns the Object Lambda Access Point. Defaults to automatically determined account ID of the AWS provider.

HasPublicAccessPolicy bool

Indicates whether this access point currently has a policy that allows public access.

Name string

The name of the Object Lambda Access Point.

Policy string

The Object Lambda Access Point resource policy document.

accountId String

The AWS account ID for the account that owns the Object Lambda Access Point. Defaults to automatically determined account ID of the AWS provider.

hasPublicAccessPolicy Boolean

Indicates whether this access point currently has a policy that allows public access.

name String

The name of the Object Lambda Access Point.

policy String

The Object Lambda Access Point resource policy document.

accountId string

The AWS account ID for the account that owns the Object Lambda Access Point. Defaults to automatically determined account ID of the AWS provider.

hasPublicAccessPolicy boolean

Indicates whether this access point currently has a policy that allows public access.

name string

The name of the Object Lambda Access Point.

policy string

The Object Lambda Access Point resource policy document.

account_id str

The AWS account ID for the account that owns the Object Lambda Access Point. Defaults to automatically determined account ID of the AWS provider.

has_public_access_policy bool

Indicates whether this access point currently has a policy that allows public access.

name str

The name of the Object Lambda Access Point.

policy str

The Object Lambda Access Point resource policy document.

accountId String

The AWS account ID for the account that owns the Object Lambda Access Point. Defaults to automatically determined account ID of the AWS provider.

hasPublicAccessPolicy Boolean

Indicates whether this access point currently has a policy that allows public access.

name String

The name of the Object Lambda Access Point.

policy String

The Object Lambda Access Point resource policy document.

Import

Object Lambda Access Point policies can be imported using the account_id and name, separated by a colon (:), e.g.

 $ pulumi import aws:s3control/objectLambdaAccessPointPolicy:ObjectLambdaAccessPointPolicy example 123456789012:example

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.