aws logo
AWS Classic v5.33.0, Mar 24 23

aws.pinpoint.EmailChannel

Provides a Pinpoint Email Channel resource.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var app = new Aws.Pinpoint.App("app");

    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.amazonaws.com",
                        },
                    },
                },
                Actions = new[]
                {
                    "sts:AssumeRole",
                },
            },
        },
    });

    var role = new Aws.Iam.Role("role", new()
    {
        AssumeRolePolicy = assumeRole.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
    });

    var email = new Aws.Pinpoint.EmailChannel("email", new()
    {
        ApplicationId = app.ApplicationId,
        FromAddress = "user@example.com",
        RoleArn = role.Arn,
    });

    var identity = new Aws.Ses.DomainIdentity("identity", new()
    {
        Domain = "example.com",
    });

    var rolePolicyPolicyDocument = Aws.Iam.GetPolicyDocument.Invoke(new()
    {
        Statements = new[]
        {
            new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
            {
                Effect = "Allow",
                Actions = new[]
                {
                    "mobileanalytics:PutEvents",
                    "mobileanalytics:PutItems",
                },
                Resources = new[]
                {
                    "*",
                },
            },
        },
    });

    var rolePolicyRolePolicy = new Aws.Iam.RolePolicy("rolePolicyRolePolicy", new()
    {
        Role = role.Id,
        Policy = rolePolicyPolicyDocument.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/iam"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/pinpoint"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ses"
	"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
		}
		assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
			Statements: []iam.GetPolicyDocumentStatement{
				{
					Effect: pulumi.StringRef("Allow"),
					Principals: []iam.GetPolicyDocumentStatementPrincipal{
						{
							Type: "Service",
							Identifiers: []string{
								"pinpoint.amazonaws.com",
							},
						},
					},
					Actions: []string{
						"sts:AssumeRole",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		role, err := iam.NewRole(ctx, "role", &iam.RoleArgs{
			AssumeRolePolicy: *pulumi.String(assumeRole.Json),
		})
		if err != nil {
			return err
		}
		_, err = pinpoint.NewEmailChannel(ctx, "email", &pinpoint.EmailChannelArgs{
			ApplicationId: app.ApplicationId,
			FromAddress:   pulumi.String("user@example.com"),
			RoleArn:       role.Arn,
		})
		if err != nil {
			return err
		}
		_, err = ses.NewDomainIdentity(ctx, "identity", &ses.DomainIdentityArgs{
			Domain: pulumi.String("example.com"),
		})
		if err != nil {
			return err
		}
		rolePolicyPolicyDocument, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
			Statements: []iam.GetPolicyDocumentStatement{
				{
					Effect: pulumi.StringRef("Allow"),
					Actions: []string{
						"mobileanalytics:PutEvents",
						"mobileanalytics:PutItems",
					},
					Resources: []string{
						"*",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		_, err = iam.NewRolePolicy(ctx, "rolePolicyRolePolicy", &iam.RolePolicyArgs{
			Role:   role.ID(),
			Policy: *pulumi.String(rolePolicyPolicyDocument.Json),
		})
		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.pinpoint.App;
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.EmailChannel;
import com.pulumi.aws.pinpoint.EmailChannelArgs;
import com.pulumi.aws.ses.DomainIdentity;
import com.pulumi.aws.ses.DomainIdentityArgs;
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");

        final var assumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
            .statements(GetPolicyDocumentStatementArgs.builder()
                .effect("Allow")
                .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                    .type("Service")
                    .identifiers("pinpoint.amazonaws.com")
                    .build())
                .actions("sts:AssumeRole")
                .build())
            .build());

        var role = new Role("role", RoleArgs.builder()        
            .assumeRolePolicy(assumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
            .build());

        var email = new EmailChannel("email", EmailChannelArgs.builder()        
            .applicationId(app.applicationId())
            .fromAddress("user@example.com")
            .roleArn(role.arn())
            .build());

        var identity = new DomainIdentity("identity", DomainIdentityArgs.builder()        
            .domain("example.com")
            .build());

        final var rolePolicyPolicyDocument = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
            .statements(GetPolicyDocumentStatementArgs.builder()
                .effect("Allow")
                .actions(                
                    "mobileanalytics:PutEvents",
                    "mobileanalytics:PutItems")
                .resources("*")
                .build())
            .build());

        var rolePolicyRolePolicy = new RolePolicy("rolePolicyRolePolicy", RolePolicyArgs.builder()        
            .role(role.id())
            .policy(rolePolicyPolicyDocument.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
            .build());

    }
}
import pulumi
import pulumi_aws as aws

app = aws.pinpoint.App("app")
assume_role = aws.iam.get_policy_document(statements=[aws.iam.GetPolicyDocumentStatementArgs(
    effect="Allow",
    principals=[aws.iam.GetPolicyDocumentStatementPrincipalArgs(
        type="Service",
        identifiers=["pinpoint.amazonaws.com"],
    )],
    actions=["sts:AssumeRole"],
)])
role = aws.iam.Role("role", assume_role_policy=assume_role.json)
email = aws.pinpoint.EmailChannel("email",
    application_id=app.application_id,
    from_address="user@example.com",
    role_arn=role.arn)
identity = aws.ses.DomainIdentity("identity", domain="example.com")
role_policy_policy_document = aws.iam.get_policy_document(statements=[aws.iam.GetPolicyDocumentStatementArgs(
    effect="Allow",
    actions=[
        "mobileanalytics:PutEvents",
        "mobileanalytics:PutItems",
    ],
    resources=["*"],
)])
role_policy_role_policy = aws.iam.RolePolicy("rolePolicyRolePolicy",
    role=role.id,
    policy=role_policy_policy_document.json)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const app = new aws.pinpoint.App("app", {});
const assumeRole = aws.iam.getPolicyDocument({
    statements: [{
        effect: "Allow",
        principals: [{
            type: "Service",
            identifiers: ["pinpoint.amazonaws.com"],
        }],
        actions: ["sts:AssumeRole"],
    }],
});
const role = new aws.iam.Role("role", {assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json)});
const email = new aws.pinpoint.EmailChannel("email", {
    applicationId: app.applicationId,
    fromAddress: "user@example.com",
    roleArn: role.arn,
});
const identity = new aws.ses.DomainIdentity("identity", {domain: "example.com"});
const rolePolicyPolicyDocument = aws.iam.getPolicyDocument({
    statements: [{
        effect: "Allow",
        actions: [
            "mobileanalytics:PutEvents",
            "mobileanalytics:PutItems",
        ],
        resources: ["*"],
    }],
});
const rolePolicyRolePolicy = new aws.iam.RolePolicy("rolePolicyRolePolicy", {
    role: role.id,
    policy: rolePolicyPolicyDocument.then(rolePolicyPolicyDocument => rolePolicyPolicyDocument.json),
});
resources:
  email:
    type: aws:pinpoint:EmailChannel
    properties:
      applicationId: ${app.applicationId}
      fromAddress: user@example.com
      roleArn: ${role.arn}
  app:
    type: aws:pinpoint:App
  identity:
    type: aws:ses:DomainIdentity
    properties:
      domain: example.com
  role:
    type: aws:iam:Role
    properties:
      assumeRolePolicy: ${assumeRole.json}
  rolePolicyRolePolicy:
    type: aws:iam:RolePolicy
    properties:
      role: ${role.id}
      policy: ${rolePolicyPolicyDocument.json}
variables:
  assumeRole:
    fn::invoke:
      Function: aws:iam:getPolicyDocument
      Arguments:
        statements:
          - effect: Allow
            principals:
              - type: Service
                identifiers:
                  - pinpoint.amazonaws.com
            actions:
              - sts:AssumeRole
  rolePolicyPolicyDocument:
    fn::invoke:
      Function: aws:iam:getPolicyDocument
      Arguments:
        statements:
          - effect: Allow
            actions:
              - mobileanalytics:PutEvents
              - mobileanalytics:PutItems
            resources:
              - '*'

Create EmailChannel Resource

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

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

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

ApplicationId string

The application ID.

FromAddress string

The email address used to send emails from. You can use email only (user@example.com) or friendly address (User <user@example.com>). This field comply with RFC 5322.

Identity string

The ARN of an identity verified with SES.

ConfigurationSet string

The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.

Enabled bool

Whether the channel is enabled or disabled. Defaults to true.

RoleArn string

The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.

ApplicationId string

The application ID.

FromAddress string

The email address used to send emails from. You can use email only (user@example.com) or friendly address (User <user@example.com>). This field comply with RFC 5322.

Identity string

The ARN of an identity verified with SES.

ConfigurationSet string

The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.

Enabled bool

Whether the channel is enabled or disabled. Defaults to true.

RoleArn string

The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.

applicationId String

The application ID.

fromAddress String

The email address used to send emails from. You can use email only (user@example.com) or friendly address (User <user@example.com>). This field comply with RFC 5322.

identity String

The ARN of an identity verified with SES.

configurationSet String

The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.

enabled Boolean

Whether the channel is enabled or disabled. Defaults to true.

roleArn String

The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.

applicationId string

The application ID.

fromAddress string

The email address used to send emails from. You can use email only (user@example.com) or friendly address (User <user@example.com>). This field comply with RFC 5322.

identity string

The ARN of an identity verified with SES.

configurationSet string

The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.

enabled boolean

Whether the channel is enabled or disabled. Defaults to true.

roleArn string

The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.

application_id str

The application ID.

from_address str

The email address used to send emails from. You can use email only (user@example.com) or friendly address (User <user@example.com>). This field comply with RFC 5322.

identity str

The ARN of an identity verified with SES.

configuration_set str

The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.

enabled bool

Whether the channel is enabled or disabled. Defaults to true.

role_arn str

The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.

applicationId String

The application ID.

fromAddress String

The email address used to send emails from. You can use email only (user@example.com) or friendly address (User <user@example.com>). This field comply with RFC 5322.

identity String

The ARN of an identity verified with SES.

configurationSet String

The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.

enabled Boolean

Whether the channel is enabled or disabled. Defaults to true.

roleArn String

The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.

Outputs

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

Id string

The provider-assigned unique ID for this managed resource.

MessagesPerSecond int

Messages per second that can be sent.

Id string

The provider-assigned unique ID for this managed resource.

MessagesPerSecond int

Messages per second that can be sent.

id String

The provider-assigned unique ID for this managed resource.

messagesPerSecond Integer

Messages per second that can be sent.

id string

The provider-assigned unique ID for this managed resource.

messagesPerSecond number

Messages per second that can be sent.

id str

The provider-assigned unique ID for this managed resource.

messages_per_second int

Messages per second that can be sent.

id String

The provider-assigned unique ID for this managed resource.

messagesPerSecond Number

Messages per second that can be sent.

Look up Existing EmailChannel Resource

Get an existing EmailChannel 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?: EmailChannelState, opts?: CustomResourceOptions): EmailChannel
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        application_id: Optional[str] = None,
        configuration_set: Optional[str] = None,
        enabled: Optional[bool] = None,
        from_address: Optional[str] = None,
        identity: Optional[str] = None,
        messages_per_second: Optional[int] = None,
        role_arn: Optional[str] = None) -> EmailChannel
func GetEmailChannel(ctx *Context, name string, id IDInput, state *EmailChannelState, opts ...ResourceOption) (*EmailChannel, error)
public static EmailChannel Get(string name, Input<string> id, EmailChannelState? state, CustomResourceOptions? opts = null)
public static EmailChannel get(String name, Output<String> id, EmailChannelState 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.

ConfigurationSet string

The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.

Enabled bool

Whether the channel is enabled or disabled. Defaults to true.

FromAddress string

The email address used to send emails from. You can use email only (user@example.com) or friendly address (User <user@example.com>). This field comply with RFC 5322.

Identity string

The ARN of an identity verified with SES.

MessagesPerSecond int

Messages per second that can be sent.

RoleArn string

The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.

ApplicationId string

The application ID.

ConfigurationSet string

The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.

Enabled bool

Whether the channel is enabled or disabled. Defaults to true.

FromAddress string

The email address used to send emails from. You can use email only (user@example.com) or friendly address (User <user@example.com>). This field comply with RFC 5322.

Identity string

The ARN of an identity verified with SES.

MessagesPerSecond int

Messages per second that can be sent.

RoleArn string

The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.

applicationId String

The application ID.

configurationSet String

The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.

enabled Boolean

Whether the channel is enabled or disabled. Defaults to true.

fromAddress String

The email address used to send emails from. You can use email only (user@example.com) or friendly address (User <user@example.com>). This field comply with RFC 5322.

identity String

The ARN of an identity verified with SES.

messagesPerSecond Integer

Messages per second that can be sent.

roleArn String

The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.

applicationId string

The application ID.

configurationSet string

The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.

enabled boolean

Whether the channel is enabled or disabled. Defaults to true.

fromAddress string

The email address used to send emails from. You can use email only (user@example.com) or friendly address (User <user@example.com>). This field comply with RFC 5322.

identity string

The ARN of an identity verified with SES.

messagesPerSecond number

Messages per second that can be sent.

roleArn string

The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.

application_id str

The application ID.

configuration_set str

The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.

enabled bool

Whether the channel is enabled or disabled. Defaults to true.

from_address str

The email address used to send emails from. You can use email only (user@example.com) or friendly address (User <user@example.com>). This field comply with RFC 5322.

identity str

The ARN of an identity verified with SES.

messages_per_second int

Messages per second that can be sent.

role_arn str

The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.

applicationId String

The application ID.

configurationSet String

The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.

enabled Boolean

Whether the channel is enabled or disabled. Defaults to true.

fromAddress String

The email address used to send emails from. You can use email only (user@example.com) or friendly address (User <user@example.com>). This field comply with RFC 5322.

identity String

The ARN of an identity verified with SES.

messagesPerSecond Number

Messages per second that can be sent.

roleArn String

The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.

Import

Pinpoint Email Channel can be imported using the application-id, e.g.,

 $ pulumi import aws:pinpoint/emailChannel:EmailChannel email application-id

Package Details

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

This Pulumi package is based on the aws Terraform Provider.