InvocationLoggingConfiguration

class InvocationLoggingConfiguration : KotlinCustomResource

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

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.BucketV2;
import com.pulumi.aws.s3.BucketV2Args;
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.resources.CustomResourceOptions;
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 current = AwsFunctions.getCallerIdentity();
var example = new BucketV2("example", BucketV2Args.builder()
.bucket("example")
.forceDestroy(true)
.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.applyValue(getCallerIdentityResult -> getCallerIdentityResult.accountId()),current.applyValue(getCallerIdentityResult -> getCallerIdentityResult.accountId()))))
.build());
var exampleInvocationLoggingConfiguration = new InvocationLoggingConfiguration("exampleInvocationLoggingConfiguration", InvocationLoggingConfigurationArgs.builder()
.loggingConfig(InvocationLoggingConfigurationLoggingConfigArgs.builder()
.embeddingDataDeliveryEnabled(true)
.imageDataDeliveryEnabled(true)
.textDataDeliveryEnabled(true)
.videoDataDeliveryEnabled(true)
.s3Config(InvocationLoggingConfigurationLoggingConfigS3ConfigArgs.builder()
.bucketName(example.id())
.keyPrefix("bedrock")
.build())
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(exampleBucketPolicy)
.build());
}
}
resources:
example:
type: aws:s3:BucketV2
properties:
bucket: example
forceDestroy: true
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:
- embeddingDataDeliveryEnabled: true
imageDataDeliveryEnabled: true
textDataDeliveryEnabled: true
videoDataDeliveryEnabled: true
s3Config:
- bucketName: ${example.id}
keyPrefix: bedrock
options:
dependsOn:
- ${exampleBucketPolicy}
variables:
current:
fn::invoke:
function: aws:getCallerIdentity
arguments: {}

Import

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

//

Properties

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

The logging configuration values to set. See logging_config Block for details.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val urn: Output<String>