1. Packages
  2. AWS
  3. API Docs
  4. ses
  5. IdentityPolicy
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.ses.IdentityPolicy

Explore with Pulumi AI

Manages a SES Identity Policy. More information about SES Sending Authorization Policies can be found in the SES Developer Guide.

Example Usage

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

const exampleDomainIdentity = new aws.ses.DomainIdentity("example", {domain: "example.com"});
const example = aws.iam.getPolicyDocumentOutput({
    statements: [{
        actions: [
            "SES:SendEmail",
            "SES:SendRawEmail",
        ],
        resources: [exampleDomainIdentity.arn],
        principals: [{
            identifiers: ["*"],
            type: "AWS",
        }],
    }],
});
const exampleIdentityPolicy = new aws.ses.IdentityPolicy("example", {
    identity: exampleDomainIdentity.arn,
    name: "example",
    policy: example.apply(example => example.json),
});
Copy
import pulumi
import pulumi_aws as aws

example_domain_identity = aws.ses.DomainIdentity("example", domain="example.com")
example = aws.iam.get_policy_document_output(statements=[{
    "actions": [
        "SES:SendEmail",
        "SES:SendRawEmail",
    ],
    "resources": [example_domain_identity.arn],
    "principals": [{
        "identifiers": ["*"],
        "type": "AWS",
    }],
}])
example_identity_policy = aws.ses.IdentityPolicy("example",
    identity=example_domain_identity.arn,
    name="example",
    policy=example.json)
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ses"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleDomainIdentity, err := ses.NewDomainIdentity(ctx, "example", &ses.DomainIdentityArgs{
			Domain: pulumi.String("example.com"),
		})
		if err != nil {
			return err
		}
		example := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
			Statements: iam.GetPolicyDocumentStatementArray{
				&iam.GetPolicyDocumentStatementArgs{
					Actions: pulumi.StringArray{
						pulumi.String("SES:SendEmail"),
						pulumi.String("SES:SendRawEmail"),
					},
					Resources: pulumi.StringArray{
						exampleDomainIdentity.Arn,
					},
					Principals: iam.GetPolicyDocumentStatementPrincipalArray{
						&iam.GetPolicyDocumentStatementPrincipalArgs{
							Identifiers: pulumi.StringArray{
								pulumi.String("*"),
							},
							Type: pulumi.String("AWS"),
						},
					},
				},
			},
		}, nil)
		_, err = ses.NewIdentityPolicy(ctx, "example", &ses.IdentityPolicyArgs{
			Identity: exampleDomainIdentity.Arn,
			Name:     pulumi.String("example"),
			Policy: pulumi.String(example.ApplyT(func(example iam.GetPolicyDocumentResult) (*string, error) {
				return &example.Json, nil
			}).(pulumi.StringPtrOutput)),
		})
		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 exampleDomainIdentity = new Aws.Ses.DomainIdentity("example", new()
    {
        Domain = "example.com",
    });

    var example = Aws.Iam.GetPolicyDocument.Invoke(new()
    {
        Statements = new[]
        {
            new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
            {
                Actions = new[]
                {
                    "SES:SendEmail",
                    "SES:SendRawEmail",
                },
                Resources = new[]
                {
                    exampleDomainIdentity.Arn,
                },
                Principals = new[]
                {
                    new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                    {
                        Identifiers = new[]
                        {
                            "*",
                        },
                        Type = "AWS",
                    },
                },
            },
        },
    });

    var exampleIdentityPolicy = new Aws.Ses.IdentityPolicy("example", new()
    {
        Identity = exampleDomainIdentity.Arn,
        Name = "example",
        Policy = example.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ses.DomainIdentity;
import com.pulumi.aws.ses.DomainIdentityArgs;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.ses.IdentityPolicy;
import com.pulumi.aws.ses.IdentityPolicyArgs;
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 exampleDomainIdentity = new DomainIdentity("exampleDomainIdentity", DomainIdentityArgs.builder()
            .domain("example.com")
            .build());

        final var example = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
            .statements(GetPolicyDocumentStatementArgs.builder()
                .actions(                
                    "SES:SendEmail",
                    "SES:SendRawEmail")
                .resources(exampleDomainIdentity.arn())
                .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                    .identifiers("*")
                    .type("AWS")
                    .build())
                .build())
            .build());

        var exampleIdentityPolicy = new IdentityPolicy("exampleIdentityPolicy", IdentityPolicyArgs.builder()
            .identity(exampleDomainIdentity.arn())
            .name("example")
            .policy(example.applyValue(_example -> _example.json()))
            .build());

    }
}
Copy
resources:
  exampleDomainIdentity:
    type: aws:ses:DomainIdentity
    name: example
    properties:
      domain: example.com
  exampleIdentityPolicy:
    type: aws:ses:IdentityPolicy
    name: example
    properties:
      identity: ${exampleDomainIdentity.arn}
      name: example
      policy: ${example.json}
variables:
  example:
    fn::invoke:
      function: aws:iam:getPolicyDocument
      arguments:
        statements:
          - actions:
              - SES:SendEmail
              - SES:SendRawEmail
            resources:
              - ${exampleDomainIdentity.arn}
            principals:
              - identifiers:
                  - '*'
                type: AWS
Copy

Create IdentityPolicy Resource

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

Constructor syntax

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

@overload
def IdentityPolicy(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   identity: Optional[str] = None,
                   policy: Optional[str] = None,
                   name: Optional[str] = None)
func NewIdentityPolicy(ctx *Context, name string, args IdentityPolicyArgs, opts ...ResourceOption) (*IdentityPolicy, error)
public IdentityPolicy(string name, IdentityPolicyArgs args, CustomResourceOptions? opts = null)
public IdentityPolicy(String name, IdentityPolicyArgs args)
public IdentityPolicy(String name, IdentityPolicyArgs args, CustomResourceOptions options)
type: aws:ses:IdentityPolicy
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. IdentityPolicyArgs
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. IdentityPolicyArgs
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. IdentityPolicyArgs
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. IdentityPolicyArgs
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. IdentityPolicyArgs
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 identityPolicyResource = new Aws.Ses.IdentityPolicy("identityPolicyResource", new()
{
    Identity = "string",
    Policy = "string",
    Name = "string",
});
Copy
example, err := ses.NewIdentityPolicy(ctx, "identityPolicyResource", &ses.IdentityPolicyArgs{
	Identity: pulumi.String("string"),
	Policy:   pulumi.String("string"),
	Name:     pulumi.String("string"),
})
Copy
var identityPolicyResource = new IdentityPolicy("identityPolicyResource", IdentityPolicyArgs.builder()
    .identity("string")
    .policy("string")
    .name("string")
    .build());
Copy
identity_policy_resource = aws.ses.IdentityPolicy("identityPolicyResource",
    identity="string",
    policy="string",
    name="string")
Copy
const identityPolicyResource = new aws.ses.IdentityPolicy("identityPolicyResource", {
    identity: "string",
    policy: "string",
    name: "string",
});
Copy
type: aws:ses:IdentityPolicy
properties:
    identity: string
    name: string
    policy: string
Copy

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

Identity
This property is required.
Changes to this property will trigger replacement.
string
Name or Amazon Resource Name (ARN) of the SES Identity.
Policy This property is required. string
JSON string of the policy.
Name Changes to this property will trigger replacement. string
Name of the policy.
Identity
This property is required.
Changes to this property will trigger replacement.
string
Name or Amazon Resource Name (ARN) of the SES Identity.
Policy This property is required. string
JSON string of the policy.
Name Changes to this property will trigger replacement. string
Name of the policy.
identity
This property is required.
Changes to this property will trigger replacement.
String
Name or Amazon Resource Name (ARN) of the SES Identity.
policy This property is required. String
JSON string of the policy.
name Changes to this property will trigger replacement. String
Name of the policy.
identity
This property is required.
Changes to this property will trigger replacement.
string
Name or Amazon Resource Name (ARN) of the SES Identity.
policy This property is required. string
JSON string of the policy.
name Changes to this property will trigger replacement. string
Name of the policy.
identity
This property is required.
Changes to this property will trigger replacement.
str
Name or Amazon Resource Name (ARN) of the SES Identity.
policy This property is required. str
JSON string of the policy.
name Changes to this property will trigger replacement. str
Name of the policy.
identity
This property is required.
Changes to this property will trigger replacement.
String
Name or Amazon Resource Name (ARN) of the SES Identity.
policy This property is required. String
JSON string of the policy.
name Changes to this property will trigger replacement. String
Name of the policy.

Outputs

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

Get an existing IdentityPolicy 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?: IdentityPolicyState, opts?: CustomResourceOptions): IdentityPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        identity: Optional[str] = None,
        name: Optional[str] = None,
        policy: Optional[str] = None) -> IdentityPolicy
func GetIdentityPolicy(ctx *Context, name string, id IDInput, state *IdentityPolicyState, opts ...ResourceOption) (*IdentityPolicy, error)
public static IdentityPolicy Get(string name, Input<string> id, IdentityPolicyState? state, CustomResourceOptions? opts = null)
public static IdentityPolicy get(String name, Output<String> id, IdentityPolicyState state, CustomResourceOptions options)
resources:  _:    type: aws:ses:IdentityPolicy    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:
Identity Changes to this property will trigger replacement. string
Name or Amazon Resource Name (ARN) of the SES Identity.
Name Changes to this property will trigger replacement. string
Name of the policy.
Policy string
JSON string of the policy.
Identity Changes to this property will trigger replacement. string
Name or Amazon Resource Name (ARN) of the SES Identity.
Name Changes to this property will trigger replacement. string
Name of the policy.
Policy string
JSON string of the policy.
identity Changes to this property will trigger replacement. String
Name or Amazon Resource Name (ARN) of the SES Identity.
name Changes to this property will trigger replacement. String
Name of the policy.
policy String
JSON string of the policy.
identity Changes to this property will trigger replacement. string
Name or Amazon Resource Name (ARN) of the SES Identity.
name Changes to this property will trigger replacement. string
Name of the policy.
policy string
JSON string of the policy.
identity Changes to this property will trigger replacement. str
Name or Amazon Resource Name (ARN) of the SES Identity.
name Changes to this property will trigger replacement. str
Name of the policy.
policy str
JSON string of the policy.
identity Changes to this property will trigger replacement. String
Name or Amazon Resource Name (ARN) of the SES Identity.
name Changes to this property will trigger replacement. String
Name of the policy.
policy String
JSON string of the policy.

Import

Using pulumi import, import SES Identity Policies using the identity and policy name, separated by a pipe character (|). For example:

$ pulumi import aws:ses/identityPolicy:IdentityPolicy example 'example.com|example'
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.