Skip to content
GitHubXDiscordRSS

ReceiptFilter

Learn how to create, update, and manage AWS SES ReceiptFilters using Alchemy Cloud Control.

The ReceiptFilter resource lets you manage AWS SES ReceiptFilters for controlling which IP addresses can send mail to your Amazon SES account.

Create a basic receipt filter that allows a specific IP address to send emails.

import AWS from "alchemy/aws/control";
const basicReceiptFilter = await AWS.SES.ReceiptFilter("basic-receipt-filter", {
Filter: {
Name: "AllowSpecificIP",
IpFilter: {
IpAddress: "203.0.113.0/24",
Policy: "Allow"
}
}
});

Configure a receipt filter with an additional option to adopt an existing resource if it already exists.

const advancedReceiptFilter = await AWS.SES.ReceiptFilter("advanced-receipt-filter", {
Filter: {
Name: "AllowMultipleIPs",
IpFilter: {
IpAddress: "198.51.100.0/24",
Policy: "Allow"
}
},
adopt: true // Adopt the existing receipt filter if it is already present
});

Create a receipt filter that denies a specific IP address from sending emails.

const denyReceiptFilter = await AWS.SES.ReceiptFilter("deny-receipt-filter", {
Filter: {
Name: "DenySpecificIP",
IpFilter: {
IpAddress: "192.0.2.0/24",
Policy: "Deny"
}
}
});

You can create multiple receipt filters to manage different sets of IP addresses.

const multipleFilters = await AWS.SES.ReceiptFilter("multiple-filters", {
Filter: {
Name: "CombinedFilters",
IpFilter: {
IpAddress: "203.0.113.0/24",
Policy: "Allow"
}
},
adopt: true // This will adopt existing resources if any
});
// Adding another filter
const secondFilter = await AWS.SES.ReceiptFilter("deny-filter", {
Filter: {
Name: "DenyIPRange",
IpFilter: {
IpAddress: "192.0.2.0/24",
Policy: "Deny"
}
}
});