1. Packages
  2. AWS Classic
  3. API Docs
  4. pinpoint
  5. EventStream

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.40.0 published on Wednesday, Jun 12, 2024 by Pulumi

aws.pinpoint.EventStream

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.40.0 published on Wednesday, Jun 12, 2024 by Pulumi

    Provides a Pinpoint Event Stream resource.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const app = new aws.pinpoint.App("app", {});
    const testStream = new aws.kinesis.Stream("test_stream", {
        name: "pinpoint-kinesis-test",
        shardCount: 1,
    });
    const assumeRole = aws.iam.getPolicyDocument({
        statements: [{
            effect: "Allow",
            principals: [{
                type: "Service",
                identifiers: ["pinpoint.us-east-1.amazonaws.com"],
            }],
            actions: ["sts:AssumeRole"],
        }],
    });
    const testRole = new aws.iam.Role("test_role", {assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json)});
    const stream = new aws.pinpoint.EventStream("stream", {
        applicationId: app.applicationId,
        destinationStreamArn: testStream.arn,
        roleArn: testRole.arn,
    });
    const testRolePolicy = aws.iam.getPolicyDocument({
        statements: [{
            effect: "Allow",
            actions: [
                "kinesis:PutRecords",
                "kinesis:DescribeStream",
            ],
            resources: ["arn:aws:kinesis:us-east-1:*:*/*"],
        }],
    });
    const testRolePolicyRolePolicy = new aws.iam.RolePolicy("test_role_policy", {
        name: "test_policy",
        role: testRole.id,
        policy: testRolePolicy.then(testRolePolicy => testRolePolicy.json),
    });
    
    import pulumi
    import pulumi_aws as aws
    
    app = aws.pinpoint.App("app")
    test_stream = aws.kinesis.Stream("test_stream",
        name="pinpoint-kinesis-test",
        shard_count=1)
    assume_role = aws.iam.get_policy_document(statements=[aws.iam.GetPolicyDocumentStatementArgs(
        effect="Allow",
        principals=[aws.iam.GetPolicyDocumentStatementPrincipalArgs(
            type="Service",
            identifiers=["pinpoint.us-east-1.amazonaws.com"],
        )],
        actions=["sts:AssumeRole"],
    )])
    test_role = aws.iam.Role("test_role", assume_role_policy=assume_role.json)
    stream = aws.pinpoint.EventStream("stream",
        application_id=app.application_id,
        destination_stream_arn=test_stream.arn,
        role_arn=test_role.arn)
    test_role_policy = aws.iam.get_policy_document(statements=[aws.iam.GetPolicyDocumentStatementArgs(
        effect="Allow",
        actions=[
            "kinesis:PutRecords",
            "kinesis:DescribeStream",
        ],
        resources=["arn:aws:kinesis:us-east-1:*:*/*"],
    )])
    test_role_policy_role_policy = aws.iam.RolePolicy("test_role_policy",
        name="test_policy",
        role=test_role.id,
        policy=test_role_policy.json)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kinesis"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/pinpoint"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		app, err := pinpoint.NewApp(ctx, "app", nil)
    		if err != nil {
    			return err
    		}
    		testStream, err := kinesis.NewStream(ctx, "test_stream", &kinesis.StreamArgs{
    			Name:       pulumi.String("pinpoint-kinesis-test"),
    			ShardCount: pulumi.Int(1),
    		})
    		if err != nil {
    			return err
    		}
    		assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
    			Statements: []iam.GetPolicyDocumentStatement{
    				{
    					Effect: pulumi.StringRef("Allow"),
    					Principals: []iam.GetPolicyDocumentStatementPrincipal{
    						{
    							Type: "Service",
    							Identifiers: []string{
    								"pinpoint.us-east-1.amazonaws.com",
    							},
    						},
    					},
    					Actions: []string{
    						"sts:AssumeRole",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		testRole, err := iam.NewRole(ctx, "test_role", &iam.RoleArgs{
    			AssumeRolePolicy: pulumi.String(assumeRole.Json),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = pinpoint.NewEventStream(ctx, "stream", &pinpoint.EventStreamArgs{
    			ApplicationId:        app.ApplicationId,
    			DestinationStreamArn: testStream.Arn,
    			RoleArn:              testRole.Arn,
    		})
    		if err != nil {
    			return err
    		}
    		testRolePolicy, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
    			Statements: []iam.GetPolicyDocumentStatement{
    				{
    					Effect: pulumi.StringRef("Allow"),
    					Actions: []string{
    						"kinesis:PutRecords",
    						"kinesis:DescribeStream",
    					},
    					Resources: []string{
    						"arn:aws:kinesis:us-east-1:*:*/*",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = iam.NewRolePolicy(ctx, "test_role_policy", &iam.RolePolicyArgs{
    			Name:   pulumi.String("test_policy"),
    			Role:   testRole.ID(),
    			Policy: pulumi.String(testRolePolicy.Json),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var app = new Aws.Pinpoint.App("app");
    
        var testStream = new Aws.Kinesis.Stream("test_stream", new()
        {
            Name = "pinpoint-kinesis-test",
            ShardCount = 1,
        });
    
        var assumeRole = Aws.Iam.GetPolicyDocument.Invoke(new()
        {
            Statements = new[]
            {
                new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
                {
                    Effect = "Allow",
                    Principals = new[]
                    {
                        new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                        {
                            Type = "Service",
                            Identifiers = new[]
                            {
                                "pinpoint.us-east-1.amazonaws.com",
                            },
                        },
                    },
                    Actions = new[]
                    {
                        "sts:AssumeRole",
                    },
                },
            },
        });
    
        var testRole = new Aws.Iam.Role("test_role", new()
        {
            AssumeRolePolicy = assumeRole.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
        });
    
        var stream = new Aws.Pinpoint.EventStream("stream", new()
        {
            ApplicationId = app.ApplicationId,
            DestinationStreamArn = testStream.Arn,
            RoleArn = testRole.Arn,
        });
    
        var testRolePolicy = Aws.Iam.GetPolicyDocument.Invoke(new()
        {
            Statements = new[]
            {
                new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
                {
                    Effect = "Allow",
                    Actions = new[]
                    {
                        "kinesis:PutRecords",
                        "kinesis:DescribeStream",
                    },
                    Resources = new[]
                    {
                        "arn:aws:kinesis:us-east-1:*:*/*",
                    },
                },
            },
        });
    
        var testRolePolicyRolePolicy = new Aws.Iam.RolePolicy("test_role_policy", new()
        {
            Name = "test_policy",
            Role = testRole.Id,
            Policy = testRolePolicy.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.pinpoint.App;
    import com.pulumi.aws.kinesis.Stream;
    import com.pulumi.aws.kinesis.StreamArgs;
    import com.pulumi.aws.iam.IamFunctions;
    import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
    import com.pulumi.aws.iam.Role;
    import com.pulumi.aws.iam.RoleArgs;
    import com.pulumi.aws.pinpoint.EventStream;
    import com.pulumi.aws.pinpoint.EventStreamArgs;
    import com.pulumi.aws.iam.RolePolicy;
    import com.pulumi.aws.iam.RolePolicyArgs;
    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 app = new App("app");
    
            var testStream = new Stream("testStream", StreamArgs.builder()
                .name("pinpoint-kinesis-test")
                .shardCount(1)
                .build());
    
            final var assumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
                .statements(GetPolicyDocumentStatementArgs.builder()
                    .effect("Allow")
                    .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                        .type("Service")
                        .identifiers("pinpoint.us-east-1.amazonaws.com")
                        .build())
                    .actions("sts:AssumeRole")
                    .build())
                .build());
    
            var testRole = new Role("testRole", RoleArgs.builder()
                .assumeRolePolicy(assumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
                .build());
    
            var stream = new EventStream("stream", EventStreamArgs.builder()
                .applicationId(app.applicationId())
                .destinationStreamArn(testStream.arn())
                .roleArn(testRole.arn())
                .build());
    
            final var testRolePolicy = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
                .statements(GetPolicyDocumentStatementArgs.builder()
                    .effect("Allow")
                    .actions(                
                        "kinesis:PutRecords",
                        "kinesis:DescribeStream")
                    .resources("arn:aws:kinesis:us-east-1:*:*/*")
                    .build())
                .build());
    
            var testRolePolicyRolePolicy = new RolePolicy("testRolePolicyRolePolicy", RolePolicyArgs.builder()
                .name("test_policy")
                .role(testRole.id())
                .policy(testRolePolicy.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
                .build());
    
        }
    }
    
    resources:
      stream:
        type: aws:pinpoint:EventStream
        properties:
          applicationId: ${app.applicationId}
          destinationStreamArn: ${testStream.arn}
          roleArn: ${testRole.arn}
      app:
        type: aws:pinpoint:App
      testStream:
        type: aws:kinesis:Stream
        name: test_stream
        properties:
          name: pinpoint-kinesis-test
          shardCount: 1
      testRole:
        type: aws:iam:Role
        name: test_role
        properties:
          assumeRolePolicy: ${assumeRole.json}
      testRolePolicyRolePolicy:
        type: aws:iam:RolePolicy
        name: test_role_policy
        properties:
          name: test_policy
          role: ${testRole.id}
          policy: ${testRolePolicy.json}
    variables:
      assumeRole:
        fn::invoke:
          Function: aws:iam:getPolicyDocument
          Arguments:
            statements:
              - effect: Allow
                principals:
                  - type: Service
                    identifiers:
                      - pinpoint.us-east-1.amazonaws.com
                actions:
                  - sts:AssumeRole
      testRolePolicy:
        fn::invoke:
          Function: aws:iam:getPolicyDocument
          Arguments:
            statements:
              - effect: Allow
                actions:
                  - kinesis:PutRecords
                  - kinesis:DescribeStream
                resources:
                  - arn:aws:kinesis:us-east-1:*:*/*
    

    Create EventStream Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new EventStream(name: string, args: EventStreamArgs, opts?: CustomResourceOptions);
    @overload
    def EventStream(resource_name: str,
                    args: EventStreamArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def EventStream(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    application_id: Optional[str] = None,
                    destination_stream_arn: Optional[str] = None,
                    role_arn: Optional[str] = None)
    func NewEventStream(ctx *Context, name string, args EventStreamArgs, opts ...ResourceOption) (*EventStream, error)
    public EventStream(string name, EventStreamArgs args, CustomResourceOptions? opts = null)
    public EventStream(String name, EventStreamArgs args)
    public EventStream(String name, EventStreamArgs args, CustomResourceOptions options)
    
    type: aws:pinpoint:EventStream
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

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

    Example

    The following reference example uses placeholder values for all input properties.

    var eventStreamResource = new Aws.Pinpoint.EventStream("eventStreamResource", new()
    {
        ApplicationId = "string",
        DestinationStreamArn = "string",
        RoleArn = "string",
    });
    
    example, err := pinpoint.NewEventStream(ctx, "eventStreamResource", &pinpoint.EventStreamArgs{
    	ApplicationId:        pulumi.String("string"),
    	DestinationStreamArn: pulumi.String("string"),
    	RoleArn:              pulumi.String("string"),
    })
    
    var eventStreamResource = new EventStream("eventStreamResource", EventStreamArgs.builder()
        .applicationId("string")
        .destinationStreamArn("string")
        .roleArn("string")
        .build());
    
    event_stream_resource = aws.pinpoint.EventStream("eventStreamResource",
        application_id="string",
        destination_stream_arn="string",
        role_arn="string")
    
    const eventStreamResource = new aws.pinpoint.EventStream("eventStreamResource", {
        applicationId: "string",
        destinationStreamArn: "string",
        roleArn: "string",
    });
    
    type: aws:pinpoint:EventStream
    properties:
        applicationId: string
        destinationStreamArn: string
        roleArn: string
    

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

    ApplicationId string
    The application ID.
    DestinationStreamArn string
    The Amazon Resource Name (ARN) of the Amazon Kinesis stream or Firehose delivery stream to which you want to publish events.
    RoleArn string
    The IAM role that authorizes Amazon Pinpoint to publish events to the stream in your account.
    ApplicationId string
    The application ID.
    DestinationStreamArn string
    The Amazon Resource Name (ARN) of the Amazon Kinesis stream or Firehose delivery stream to which you want to publish events.
    RoleArn string
    The IAM role that authorizes Amazon Pinpoint to publish events to the stream in your account.
    applicationId String
    The application ID.
    destinationStreamArn String
    The Amazon Resource Name (ARN) of the Amazon Kinesis stream or Firehose delivery stream to which you want to publish events.
    roleArn String
    The IAM role that authorizes Amazon Pinpoint to publish events to the stream in your account.
    applicationId string
    The application ID.
    destinationStreamArn string
    The Amazon Resource Name (ARN) of the Amazon Kinesis stream or Firehose delivery stream to which you want to publish events.
    roleArn string
    The IAM role that authorizes Amazon Pinpoint to publish events to the stream in your account.
    application_id str
    The application ID.
    destination_stream_arn str
    The Amazon Resource Name (ARN) of the Amazon Kinesis stream or Firehose delivery stream to which you want to publish events.
    role_arn str
    The IAM role that authorizes Amazon Pinpoint to publish events to the stream in your account.
    applicationId String
    The application ID.
    destinationStreamArn String
    The Amazon Resource Name (ARN) of the Amazon Kinesis stream or Firehose delivery stream to which you want to publish events.
    roleArn String
    The IAM role that authorizes Amazon Pinpoint to publish events to the stream in your account.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the EventStream 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 EventStream Resource

    Get an existing EventStream 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?: EventStreamState, opts?: CustomResourceOptions): EventStream
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            application_id: Optional[str] = None,
            destination_stream_arn: Optional[str] = None,
            role_arn: Optional[str] = None) -> EventStream
    func GetEventStream(ctx *Context, name string, id IDInput, state *EventStreamState, opts ...ResourceOption) (*EventStream, error)
    public static EventStream Get(string name, Input<string> id, EventStreamState? state, CustomResourceOptions? opts = null)
    public static EventStream get(String name, Output<String> id, EventStreamState 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:
    ApplicationId string
    The application ID.
    DestinationStreamArn string
    The Amazon Resource Name (ARN) of the Amazon Kinesis stream or Firehose delivery stream to which you want to publish events.
    RoleArn string
    The IAM role that authorizes Amazon Pinpoint to publish events to the stream in your account.
    ApplicationId string
    The application ID.
    DestinationStreamArn string
    The Amazon Resource Name (ARN) of the Amazon Kinesis stream or Firehose delivery stream to which you want to publish events.
    RoleArn string
    The IAM role that authorizes Amazon Pinpoint to publish events to the stream in your account.
    applicationId String
    The application ID.
    destinationStreamArn String
    The Amazon Resource Name (ARN) of the Amazon Kinesis stream or Firehose delivery stream to which you want to publish events.
    roleArn String
    The IAM role that authorizes Amazon Pinpoint to publish events to the stream in your account.
    applicationId string
    The application ID.
    destinationStreamArn string
    The Amazon Resource Name (ARN) of the Amazon Kinesis stream or Firehose delivery stream to which you want to publish events.
    roleArn string
    The IAM role that authorizes Amazon Pinpoint to publish events to the stream in your account.
    application_id str
    The application ID.
    destination_stream_arn str
    The Amazon Resource Name (ARN) of the Amazon Kinesis stream or Firehose delivery stream to which you want to publish events.
    role_arn str
    The IAM role that authorizes Amazon Pinpoint to publish events to the stream in your account.
    applicationId String
    The application ID.
    destinationStreamArn String
    The Amazon Resource Name (ARN) of the Amazon Kinesis stream or Firehose delivery stream to which you want to publish events.
    roleArn String
    The IAM role that authorizes Amazon Pinpoint to publish events to the stream in your account.

    Import

    Using pulumi import, import Pinpoint Event Stream using the application-id. For example:

    $ pulumi import aws:pinpoint/eventStream:EventStream stream application-id
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.40.0 published on Wednesday, Jun 12, 2024 by Pulumi