InvocationLoggingConfiguration class
Manages Bedrock model invocation logging configuration.
> Model invocation logging is configured per AWS region. To avoid overwriting settings, this resource should not be defined in multiple configurations.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const current = aws.getCallerIdentity({});
const example = new aws.s3.Bucket("example", {
bucket: "example",
forceDestroy: true,
}, {
ignoreChanges: [
"tags[\"CreatorId\"]",
"tags[\"CreatorName\"]",
],
});
const exampleBucketPolicy = new aws.s3.BucketPolicy("example", {
bucket: example.bucket,
policy: pulumi.all([example.arn, current]).apply(([arn, current]) => `{
\"Version\": \"2012-10-17\",
\"Statement\": [
{
\"Effect\": \"Allow\",
\"Principal\": {
\"Service\": \"bedrock.amazonaws.com\"
},
\"Action\": [
\"s3:*\"
],
\"Resource\": [
\"${arn}/*\"
],
\"Condition\": {
\"StringEquals\": {
\"aws:SourceAccount\": \"${current.accountId}\"
},
\"ArnLike\": {
\"aws:SourceArn\": \"arn:aws:bedrock:us-east-1:${current.accountId}:*\"
}
}
}
]
}
`),
});
const exampleInvocationLoggingConfiguration = new aws.bedrockmodel.InvocationLoggingConfiguration("example", {loggingConfig: {
s3Config: {
bucketName: example.id,
keyPrefix: "bedrock",
},
embeddingDataDeliveryEnabled: true,
imageDataDeliveryEnabled: true,
textDataDeliveryEnabled: true,
videoDataDeliveryEnabled: true,
}}, {
dependsOn: [exampleBucketPolicy],
});
import pulumi
import pulumi_aws as aws
current = aws.get_caller_identity()
example = aws.s3.Bucket("example",
bucket="example",
force_destroy=True,
opts = pulumi.ResourceOptions(ignore_changes=[
"tags[\"CreatorId\"]",
"tags[\"CreatorName\"]",
]))
example_bucket_policy = aws.s3.BucketPolicy("example",
bucket=example.bucket,
policy=example.arn.apply(lambda arn: f"""{{
\"Version\": \"2012-10-17\",
\"Statement\": [
{{
\"Effect\": \"Allow\",
\"Principal\": {{
\"Service\": \"bedrock.amazonaws.com\"
}},
\"Action\": [
\"s3:*\"
],
\"Resource\": [
\"{arn}/*\"
],
\"Condition\": {{
\"StringEquals\": {{
\"aws:SourceAccount\": \"{current.account_id}\"
}},
\"ArnLike\": {{
\"aws:SourceArn\": \"arn:aws:bedrock:us-east-1:{current.account_id}:*\"
}}
}}
}}
]
}}
"""))
example_invocation_logging_configuration = aws.bedrockmodel.InvocationLoggingConfiguration("example", logging_config={
"s3_config": {
"bucket_name": example.id,
"key_prefix": "bedrock",
},
"embedding_data_delivery_enabled": True,
"image_data_delivery_enabled": True,
"text_data_delivery_enabled": True,
"video_data_delivery_enabled": True,
},
opts = pulumi.ResourceOptions(depends_on=[example_bucket_policy]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var current = Aws.GetCallerIdentity.Invoke();
var example = new Aws.S3.Bucket("example", new()
{
BucketName = "example",
ForceDestroy = true,
}, new CustomResourceOptions
{
IgnoreChanges =
{
"tags[\"CreatorId\"]",
"tags[\"CreatorName\"]",
},
});
var exampleBucketPolicy = new Aws.S3.BucketPolicy("example", new()
{
Bucket = example.BucketName,
Policy = Output.Tuple(example.Arn, current).Apply(values =>
{
var arn = values.Item1;
var current = values.Item2;
return @$"{{
\""Version\"": \""2012-10-17\"",
\""Statement\"": [
{{
\""Effect\"": \""Allow\"",
\""Principal\"": {{
\""Service\"": \""bedrock.amazonaws.com\""
}},
\""Action\"": [
\""s3:*\""
],
\""Resource\"": [
\""{arn}/*\""
],
\""Condition\"": {{
\""StringEquals\"": {{
\""aws:SourceAccount\"": \""{current.Apply(getCallerIdentityResult => getCallerIdentityResult.AccountId)}\""
}},
\""ArnLike\"": {{
\""aws:SourceArn\"": \""arn:aws:bedrock:us-east-1:{current.Apply(getCallerIdentityResult => getCallerIdentityResult.AccountId)}:*\""
}}
}}
}}
]
}}
";
}),
});
var exampleInvocationLoggingConfiguration = new Aws.BedrockModel.InvocationLoggingConfiguration("example", new()
{
LoggingConfig = new Aws.BedrockModel.Inputs.InvocationLoggingConfigurationLoggingConfigArgs
{
S3Config = new Aws.BedrockModel.Inputs.InvocationLoggingConfigurationLoggingConfigS3ConfigArgs
{
BucketName = example.Id,
KeyPrefix = "bedrock",
},
EmbeddingDataDeliveryEnabled = true,
ImageDataDeliveryEnabled = true,
TextDataDeliveryEnabled = true,
VideoDataDeliveryEnabled = true,
},
}, new CustomResourceOptions
{
DependsOn =
{
exampleBucketPolicy,
},
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/bedrockmodel"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/s3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
current, err := aws.GetCallerIdentity(ctx, &aws.GetCallerIdentityArgs{}, nil)
if err != nil {
return err
}
example, err := s3.NewBucket(ctx, "example", &s3.BucketArgs{
Bucket: pulumi.String("example"),
ForceDestroy: pulumi.Bool(true),
}, pulumi.IgnoreChanges([]string{
"tags[\"CreatorId\"]",
"tags[\"CreatorName\"]",
}))
if err != nil {
return err
}
exampleBucketPolicy, err := s3.NewBucketPolicy(ctx, "example", &s3.BucketPolicyArgs{
Bucket: example.Bucket,
Policy: example.Arn.ApplyT(func(arn string) (string, error) {
return fmt.Sprintf(`{
\"Version\": \"2012-10-17\",
\"Statement\": [
{
\"Effect\": \"Allow\",
\"Principal\": {
\"Service\": \"bedrock.amazonaws.com\"
},
\"Action\": [
\"s3:*\"
],
\"Resource\": [
\"%v/*\"
],
\"Condition\": {
\"StringEquals\": {
\"aws:SourceAccount\": \"%v\"
},
\"ArnLike\": {
\"aws:SourceArn\": \"arn:aws:bedrock:us-east-1:%v:*\"
}
}
}
]
}
`, arn, current.AccountId, current.AccountId), nil
}).(pulumi.StringOutput),
})
if err != nil {
return err
}
_, err = bedrockmodel.NewInvocationLoggingConfiguration(ctx, "example", &bedrockmodel.InvocationLoggingConfigurationArgs{
LoggingConfig: &bedrockmodel.InvocationLoggingConfigurationLoggingConfigArgs{
S3Config: &bedrockmodel.InvocationLoggingConfigurationLoggingConfigS3ConfigArgs{
BucketName: example.ID().ToIDOutput().ToStringOutput(),
KeyPrefix: pulumi.String("bedrock"),
},
EmbeddingDataDeliveryEnabled: pulumi.Bool(true),
ImageDataDeliveryEnabled: pulumi.Bool(true),
TextDataDeliveryEnabled: pulumi.Bool(true),
VideoDataDeliveryEnabled: pulumi.Bool(true),
},
}, pulumi.DependsOn([]pulumi.Resource{
exampleBucketPolicy,
}))
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
data "aws_getcalleridentity" "current" {
}
resource "aws_s3_bucket" "example" {
lifecycle {
ignore_changes = [tags["CreatorId"], tags["CreatorName"]]
}
bucket = "example"
force_destroy = true
}
resource "aws_s3_bucketpolicy" "example" {
bucket = aws_s3_bucket.example.bucket
policy ="{
\"Version\": \"2012-10-17\",
\"Statement\": [
{
\"Effect\": \"Allow\",
\"Principal\": {
\"Service\": \"bedrock.amazonaws.com\"
},
\"Action\": [
\"s3:*\"
],
\"Resource\": [
\"${aws_s3_bucket.example.arn}/*\"
],
\"Condition\": {
\"StringEquals\": {
\"aws:SourceAccount\": \"${data.aws_getcalleridentity.current.account_id}\"
},
\"ArnLike\": {
\"aws:SourceArn\": \"arn:aws:bedrock:us-east-1:${data.aws_getcalleridentity.current.account_id}:*\"
}
}
}
]
}
"
}
resource "aws_bedrockmodel_invocationloggingconfiguration" "example" {
depends_on = [aws_s3_bucketpolicy.example]
logging_config = {
s3_config = {
bucket_name = aws_s3_bucket.example.id
key_prefix = "bedrock"
}
embedding_data_delivery_enabled = true
image_data_delivery_enabled = true
text_data_delivery_enabled = true
video_data_delivery_enabled = true
}
}
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.GetCallerIdentityArgs;
import com.pulumi.aws.s3.Bucket;
import com.pulumi.aws.s3.BucketArgs;
import com.pulumi.aws.s3.BucketPolicy;
import com.pulumi.aws.s3.BucketPolicyArgs;
import com.pulumi.aws.bedrockmodel.InvocationLoggingConfiguration;
import com.pulumi.aws.bedrockmodel.InvocationLoggingConfigurationArgs;
import com.pulumi.aws.bedrockmodel.inputs.InvocationLoggingConfigurationLoggingConfigArgs;
import com.pulumi.aws.bedrockmodel.inputs.InvocationLoggingConfigurationLoggingConfigS3ConfigArgs;
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) {
final var current = AwsFunctions.getCallerIdentity(GetCallerIdentityArgs.builder()
.build());
var example = new Bucket("example", BucketArgs.builder()
.bucket("example")
.forceDestroy(true)
.build(), CustomResourceOptions.builder()
.ignoreChanges("tags[\"CreatorId\"]", "tags[\"CreatorName\"]")
.build());
var exampleBucketPolicy = new BucketPolicy("exampleBucketPolicy", BucketPolicyArgs.builder()
.bucket(example.bucket())
.policy(example.arn().applyValue(_arn -> """
{
\"Version\": \"2012-10-17\",
\"Statement\": [
{
\"Effect\": \"Allow\",
\"Principal\": {
\"Service\": \"bedrock.amazonaws.com\"
},
\"Action\": [
\"s3:*\"
],
\"Resource\": [
\"%s/*\"
],
\"Condition\": {
\"StringEquals\": {
\"aws:SourceAccount\": \"%s\"
},
\"ArnLike\": {
\"aws:SourceArn\": \"arn:aws:bedrock:us-east-1:%s:*\"
}
}
}
]
}
", _arn,current.accountId(),current.accountId())))
.build());
var exampleInvocationLoggingConfiguration = new InvocationLoggingConfiguration("exampleInvocationLoggingConfiguration", InvocationLoggingConfigurationArgs.builder()
.loggingConfig(InvocationLoggingConfigurationLoggingConfigArgs.builder()
.s3Config(InvocationLoggingConfigurationLoggingConfigS3ConfigArgs.builder()
.bucketName(example.id())
.keyPrefix("bedrock")
.build())
.embeddingDataDeliveryEnabled(true)
.imageDataDeliveryEnabled(true)
.textDataDeliveryEnabled(true)
.videoDataDeliveryEnabled(true)
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(exampleBucketPolicy)
.build());
}
}
resources:
example:
type: aws:s3:Bucket
properties:
bucket: example
forceDestroy: true
options:
ignoreChanges:
- tags.CreatorId
- tags.CreatorName
exampleBucketPolicy:
type: aws:s3:BucketPolicy
name: example
properties:
bucket: ${example.bucket}
policy: |
{
\"Version\": \"2012-10-17\",
\"Statement\": [
{
\"Effect\": \"Allow\",
\"Principal\": {
\"Service\": \"bedrock.amazonaws.com\"
},
\"Action\": [
\"s3:*\"
],
\"Resource\": [
\"${example.arn}/*\"
],
\"Condition\": {
\"StringEquals\": {
\"aws:SourceAccount\": \"${current.accountId}\"
},
\"ArnLike\": {
\"aws:SourceArn\": \"arn:aws:bedrock:us-east-1:${current.accountId}:*\"
}
}
}
]
}
exampleInvocationLoggingConfiguration:
type: aws:bedrockmodel:InvocationLoggingConfiguration
name: example
properties:
loggingConfig:
s3Config:
bucketName: ${example.id}
keyPrefix: bedrock
embeddingDataDeliveryEnabled: true
imageDataDeliveryEnabled: true
textDataDeliveryEnabled: true
videoDataDeliveryEnabled: true
options:
dependsOn:
- ${exampleBucketPolicy}
variables:
current:
fn::invoke:
function: aws:getCallerIdentity
arguments: {}
Import
Identity Schema
Optional
accountId(String) AWS Account where this resource is managed.region(String) Region where this resource is managed.
Using pulumi import, import Bedrock custom model using the id set to the AWS Region. For example:
$ pulumi import aws:bedrockmodel/invocationLoggingConfiguration:InvocationLoggingConfiguration my_config us-east-1
Constructors
- InvocationLoggingConfiguration(String name, {InvocationLoggingConfigurationArgs? args, CustomResourceOptions? options})
-
Creates a new InvocationLoggingConfiguration.
nameThe Pulumi resource name.argsArguments used to configure this InvocationLoggingConfiguration. The set of arguments for InvocationLoggingConfiguration.optionsResource options controlling this resource's behavior. - InvocationLoggingConfiguration.reference(String urn)
- Creates a typed reference to an existing InvocationLoggingConfiguration resource.
Properties
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- 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
-
loggingConfig
↔ Output<
InvocationLoggingConfigurationLoggingConfig> -
The logging configuration values to set. See
loggingConfigBlock for details.latefinal -
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
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
Static Methods
-
get(
String name, Input< String> id, {InvocationLoggingConfigurationState? state, CustomResourceOptions? options}) → InvocationLoggingConfiguration -
Gets an existing InvocationLoggingConfiguration resource's state with the given
nameandid.