1. Packages
  2. AWS
  3. API Docs
  4. sesv2
  5. EmailIdentityPolicy
AWS v6.71.0 published on Friday, Mar 7, 2025 by Pulumi

aws.sesv2.EmailIdentityPolicy

Explore with Pulumi AI

Resource for managing an AWS SESv2 (Simple Email V2) Email Identity Policy.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.sesv2.EmailIdentity("example", {emailIdentity: "testing@example.com"});
const exampleEmailIdentityPolicy = new aws.sesv2.EmailIdentityPolicy("example", {
    emailIdentity: example.emailIdentity,
    policyName: "example",
    policy: pulumi.interpolate`{
  "Id":"ExampleAuthorizationPolicy",
  "Version":"2012-10-17",
  "Statement":[
    {
      "Sid":"AuthorizeIAMUser",
      "Effect":"Allow",
      "Resource":"${example.arn}",
      "Principal":{
        "AWS":[
          "arn:aws:iam::123456789012:user/John",
          "arn:aws:iam::123456789012:user/Jane"
        ]
      },
      "Action":[
        "ses:DeleteEmailIdentity",
        "ses:PutEmailIdentityDkimSigningAttributes"
      ]
    }
  ]
}
`,
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.sesv2.EmailIdentity("example", email_identity="testing@example.com")
example_email_identity_policy = aws.sesv2.EmailIdentityPolicy("example",
    email_identity=example.email_identity,
    policy_name="example",
    policy=example.arn.apply(lambda arn: f"""{{
  "Id":"ExampleAuthorizationPolicy",
  "Version":"2012-10-17",
  "Statement":[
    {{
      "Sid":"AuthorizeIAMUser",
      "Effect":"Allow",
      "Resource":"{arn}",
      "Principal":{{
        "AWS":[
          "arn:aws:iam::123456789012:user/John",
          "arn:aws:iam::123456789012:user/Jane"
        ]
      }},
      "Action":[
        "ses:DeleteEmailIdentity",
        "ses:PutEmailIdentityDkimSigningAttributes"
      ]
    }}
  ]
}}
"""))
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sesv2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := sesv2.NewEmailIdentity(ctx, "example", &sesv2.EmailIdentityArgs{
			EmailIdentity: pulumi.String("testing@example.com"),
		})
		if err != nil {
			return err
		}
		_, err = sesv2.NewEmailIdentityPolicy(ctx, "example", &sesv2.EmailIdentityPolicyArgs{
			EmailIdentity: example.EmailIdentity,
			PolicyName:    pulumi.String("example"),
			Policy: example.Arn.ApplyT(func(arn string) (string, error) {
				return fmt.Sprintf(`{
  "Id":"ExampleAuthorizationPolicy",
  "Version":"2012-10-17",
  "Statement":[
    {
      "Sid":"AuthorizeIAMUser",
      "Effect":"Allow",
      "Resource":"%v",
      "Principal":{
        "AWS":[
          "arn:aws:iam::123456789012:user/John",
          "arn:aws:iam::123456789012:user/Jane"
        ]
      },
      "Action":[
        "ses:DeleteEmailIdentity",
        "ses:PutEmailIdentityDkimSigningAttributes"
      ]
    }
  ]
}
`, arn), nil
			}).(pulumi.StringOutput),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.SesV2.EmailIdentity("example", new()
    {
        EmailIdentityDetails = "testing@example.com",
    });

    var exampleEmailIdentityPolicy = new Aws.SesV2.EmailIdentityPolicy("example", new()
    {
        EmailIdentity = example.EmailIdentityDetails,
        PolicyName = "example",
        Policy = example.Arn.Apply(arn => @$"{{
  ""Id"":""ExampleAuthorizationPolicy"",
  ""Version"":""2012-10-17"",
  ""Statement"":[
    {{
      ""Sid"":""AuthorizeIAMUser"",
      ""Effect"":""Allow"",
      ""Resource"":""{arn}"",
      ""Principal"":{{
        ""AWS"":[
          ""arn:aws:iam::123456789012:user/John"",
          ""arn:aws:iam::123456789012:user/Jane""
        ]
      }},
      ""Action"":[
        ""ses:DeleteEmailIdentity"",
        ""ses:PutEmailIdentityDkimSigningAttributes""
      ]
    }}
  ]
}}
"),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sesv2.EmailIdentity;
import com.pulumi.aws.sesv2.EmailIdentityArgs;
import com.pulumi.aws.sesv2.EmailIdentityPolicy;
import com.pulumi.aws.sesv2.EmailIdentityPolicyArgs;
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 example = new EmailIdentity("example", EmailIdentityArgs.builder()
            .emailIdentity("testing@example.com")
            .build());

        var exampleEmailIdentityPolicy = new EmailIdentityPolicy("exampleEmailIdentityPolicy", EmailIdentityPolicyArgs.builder()
            .emailIdentity(example.emailIdentity())
            .policyName("example")
            .policy(example.arn().applyValue(arn -> """
{
  "Id":"ExampleAuthorizationPolicy",
  "Version":"2012-10-17",
  "Statement":[
    {
      "Sid":"AuthorizeIAMUser",
      "Effect":"Allow",
      "Resource":"%s",
      "Principal":{
        "AWS":[
          "arn:aws:iam::123456789012:user/John",
          "arn:aws:iam::123456789012:user/Jane"
        ]
      },
      "Action":[
        "ses:DeleteEmailIdentity",
        "ses:PutEmailIdentityDkimSigningAttributes"
      ]
    }
  ]
}
", arn)))
            .build());

    }
}
Copy
resources:
  example:
    type: aws:sesv2:EmailIdentity
    properties:
      emailIdentity: testing@example.com
  exampleEmailIdentityPolicy:
    type: aws:sesv2:EmailIdentityPolicy
    name: example
    properties:
      emailIdentity: ${example.emailIdentity}
      policyName: example
      policy: |
        {
          "Id":"ExampleAuthorizationPolicy",
          "Version":"2012-10-17",
          "Statement":[
            {
              "Sid":"AuthorizeIAMUser",
              "Effect":"Allow",
              "Resource":"${example.arn}",
              "Principal":{
                "AWS":[
                  "arn:aws:iam::123456789012:user/John",
                  "arn:aws:iam::123456789012:user/Jane"
                ]
              },
              "Action":[
                "ses:DeleteEmailIdentity",
                "ses:PutEmailIdentityDkimSigningAttributes"
              ]
            }
          ]
        }        
Copy

Create EmailIdentityPolicy Resource

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

Constructor syntax

new EmailIdentityPolicy(name: string, args: EmailIdentityPolicyArgs, opts?: CustomResourceOptions);
@overload
def EmailIdentityPolicy(resource_name: str,
                        args: EmailIdentityPolicyArgs,
                        opts: Optional[ResourceOptions] = None)

@overload
def EmailIdentityPolicy(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        email_identity: Optional[str] = None,
                        policy: Optional[str] = None,
                        policy_name: Optional[str] = None)
func NewEmailIdentityPolicy(ctx *Context, name string, args EmailIdentityPolicyArgs, opts ...ResourceOption) (*EmailIdentityPolicy, error)
public EmailIdentityPolicy(string name, EmailIdentityPolicyArgs args, CustomResourceOptions? opts = null)
public EmailIdentityPolicy(String name, EmailIdentityPolicyArgs args)
public EmailIdentityPolicy(String name, EmailIdentityPolicyArgs args, CustomResourceOptions options)
type: aws:sesv2:EmailIdentityPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. EmailIdentityPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. EmailIdentityPolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. EmailIdentityPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. EmailIdentityPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. EmailIdentityPolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

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

var emailIdentityPolicyResource = new Aws.SesV2.EmailIdentityPolicy("emailIdentityPolicyResource", new()
{
    EmailIdentity = "string",
    Policy = "string",
    PolicyName = "string",
});
Copy
example, err := sesv2.NewEmailIdentityPolicy(ctx, "emailIdentityPolicyResource", &sesv2.EmailIdentityPolicyArgs{
	EmailIdentity: pulumi.String("string"),
	Policy:        pulumi.String("string"),
	PolicyName:    pulumi.String("string"),
})
Copy
var emailIdentityPolicyResource = new EmailIdentityPolicy("emailIdentityPolicyResource", EmailIdentityPolicyArgs.builder()
    .emailIdentity("string")
    .policy("string")
    .policyName("string")
    .build());
Copy
email_identity_policy_resource = aws.sesv2.EmailIdentityPolicy("emailIdentityPolicyResource",
    email_identity="string",
    policy="string",
    policy_name="string")
Copy
const emailIdentityPolicyResource = new aws.sesv2.EmailIdentityPolicy("emailIdentityPolicyResource", {
    emailIdentity: "string",
    policy: "string",
    policyName: "string",
});
Copy
type: aws:sesv2:EmailIdentityPolicy
properties:
    emailIdentity: string
    policy: string
    policyName: string
Copy

EmailIdentityPolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The EmailIdentityPolicy resource accepts the following input properties:

EmailIdentity
This property is required.
Changes to this property will trigger replacement.
string
The email identity.
Policy This property is required. string
The text of the policy in JSON format.
PolicyName
This property is required.
Changes to this property will trigger replacement.
string
The name of the policy.
EmailIdentity
This property is required.
Changes to this property will trigger replacement.
string
The email identity.
Policy This property is required. string
The text of the policy in JSON format.
PolicyName
This property is required.
Changes to this property will trigger replacement.
string
The name of the policy.
emailIdentity
This property is required.
Changes to this property will trigger replacement.
String
The email identity.
policy This property is required. String
The text of the policy in JSON format.
policyName
This property is required.
Changes to this property will trigger replacement.
String
The name of the policy.
emailIdentity
This property is required.
Changes to this property will trigger replacement.
string
The email identity.
policy This property is required. string
The text of the policy in JSON format.
policyName
This property is required.
Changes to this property will trigger replacement.
string
The name of the policy.
email_identity
This property is required.
Changes to this property will trigger replacement.
str
The email identity.
policy This property is required. str
The text of the policy in JSON format.
policy_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the policy.
emailIdentity
This property is required.
Changes to this property will trigger replacement.
String
The email identity.
policy This property is required. String
The text of the policy in JSON format.
policyName
This property is required.
Changes to this property will trigger replacement.
String
The name of the policy.

Outputs

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

Get an existing EmailIdentityPolicy 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?: EmailIdentityPolicyState, opts?: CustomResourceOptions): EmailIdentityPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        email_identity: Optional[str] = None,
        policy: Optional[str] = None,
        policy_name: Optional[str] = None) -> EmailIdentityPolicy
func GetEmailIdentityPolicy(ctx *Context, name string, id IDInput, state *EmailIdentityPolicyState, opts ...ResourceOption) (*EmailIdentityPolicy, error)
public static EmailIdentityPolicy Get(string name, Input<string> id, EmailIdentityPolicyState? state, CustomResourceOptions? opts = null)
public static EmailIdentityPolicy get(String name, Output<String> id, EmailIdentityPolicyState state, CustomResourceOptions options)
resources:  _:    type: aws:sesv2:EmailIdentityPolicy    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
EmailIdentity Changes to this property will trigger replacement. string
The email identity.
Policy string
The text of the policy in JSON format.
PolicyName Changes to this property will trigger replacement. string
The name of the policy.
EmailIdentity Changes to this property will trigger replacement. string
The email identity.
Policy string
The text of the policy in JSON format.
PolicyName Changes to this property will trigger replacement. string
The name of the policy.
emailIdentity Changes to this property will trigger replacement. String
The email identity.
policy String
The text of the policy in JSON format.
policyName Changes to this property will trigger replacement. String
The name of the policy.
emailIdentity Changes to this property will trigger replacement. string
The email identity.
policy string
The text of the policy in JSON format.
policyName Changes to this property will trigger replacement. string
The name of the policy.
email_identity Changes to this property will trigger replacement. str
The email identity.
policy str
The text of the policy in JSON format.
policy_name Changes to this property will trigger replacement. str
The name of the policy.
emailIdentity Changes to this property will trigger replacement. String
The email identity.
policy String
The text of the policy in JSON format.
policyName Changes to this property will trigger replacement. String
The name of the policy.

Import

Using pulumi import, import SESv2 (Simple Email V2) Email Identity Policy using the example_id_arg. For example:

$ pulumi import aws:sesv2/emailIdentityPolicy:EmailIdentityPolicy example example_email_identity|example_policy_name
Copy

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.