LinuxCommandLibrary

aws-ses

Send emails via Amazon Simple Email Service

TLDR

Create a new receipt rule set

$ aws ses create-receipt-rule-set --rule-set-name [rule_set_name] --generate-cli-skeleton
copy

Describe the active receipt rule set
$ aws ses describe-active-receipt-rule-set --generate-cli-skeletion
copy

Describe a specific receipt rule
$ aws ses describe-receipt-rule --rule-set-name [rule_set_name] --rule-name [rule_name] --generate-cli-skeleton
copy

List all receipt rule sets
$ aws ses list-receipt-rule-sets --starting-token [token_string] --max-items [integer] --generate-cli-skeleton
copy

Delete a specific receipt rule set (the currently active rule set cannot be deleted)
$ aws ses delete-receipt-rule-set --rule-set-name [rule_set_name] --generate-cli-skeleton
copy

Delete a specific receipt rule
$ aws ses delete-receipt-rule --rule-set-name [rule_set_name] --rule-name [rule_name] --generate-cli-skeleton
copy

Send an email
$ aws ses send-email --from [from_address] --destination "ToAddresses=[addresses]" --message "Subject={Data=[subject_text],Charset=utf8},Body={Text={Data=[body_text],Charset=utf8},Html={Data=[message_body_containing_html],Charset=utf8]"
copy

Display help for a specific SES subcommand
$ aws ses [subcommand] help
copy

SYNOPSIS

aws ses <command> <options>

PARAMETERS

send-email
    Sends a single email message. Requires specifying source, destination, and message details.

send-raw-email
    Sends a raw email message. Provides full control over the email's content, including headers and MIME structure.

verify-email-identity
    Initiates the email address verification process for the specified address. Used to prove ownership of the email address.

delete-identity
    Deletes the specified identity (email address or domain) from your SES account.

list-identities
    Lists all identities (email addresses and domains) associated with your SES account.

get-identity-verification-attributes
    Returns verification attributes for a list of identities

--output
    Specifies the output format (e.g., json, text, table).

--query
    Filters the output using a JMESPath query.

--debug
    Enables debug logging for the AWS CLI.

DESCRIPTION

The `aws ses` command is part of the AWS Command Line Interface (CLI) and provides a way to interact with the Amazon Simple Email Service (SES) directly from the Linux command line. It allows you to send emails, verify email addresses, manage identities (domains and email addresses), and configure sending quotas. Using this command requires that you have the AWS CLI installed and configured with appropriate credentials that grant permissions to access SES. It's commonly used in automation scripts, CI/CD pipelines, and ad-hoc email sending from servers.

This functionality is crucial for applications that need to send transactional emails (like account verification or password resets), marketing emails, or notifications. The `aws ses` command offers a powerful and flexible way to integrate email sending capabilities into your infrastructure without relying on external email providers or managing your own email servers. The underlying SES service manages email deliverability and reputation, greatly simplifying the task of reliable email sending. Be sure to configure your AWS credentials with the proper permissions to utilize SES effectively and safely. Also, initially SES limits sending quotas. Requesting an increase is required for production usage.

CAVEATS

Requires properly configured AWS CLI credentials with SES permissions. Sending quotas apply and may need to be increased for production use. Incorrect usage can lead to email sending failures or security vulnerabilities.

AUTHENTICATION

To use the `aws ses` command, you must configure the AWS CLI with valid credentials. This typically involves setting up an IAM user with the `AmazonSESFullAccess` policy (or a more restrictive policy tailored to your needs) and configuring the CLI with the user's access key ID and secret access key, region and output format. For improved security, consider using IAM roles and instance profiles instead of storing credentials directly on your system.

ERROR HANDLING

The `aws ses` command can return various error codes and messages. Common errors include authentication failures, permission issues, invalid parameters, and exceeding sending quotas. Review the AWS SES documentation for a comprehensive list of error codes and troubleshooting tips. Utilizing the `--debug` option can provide more verbose output to aid in diagnosing issues.

EXAMPLE: SENDING A SIMPLE EMAIL

```bash aws ses send-email \ --from sender@example.com \ --destination '{"ToAddresses": ["recipient@example.com"]}' \ --message '{"Subject": {"Data": "Test Email"}, "Body": {"Text": {"Data": "This is a test email sent using the AWS SES CLI."}}}' ```

HISTORY

The `aws ses` command was introduced as part of the AWS Command Line Interface (CLI) to provide a programmatic way to interact with the Amazon Simple Email Service (SES). Its development reflects the increasing need for cloud-based email sending solutions and the desire to automate email-related tasks. It allows system administrators and developers to integrate email sending capabilities into their workflows and applications more easily than using the AWS Management Console or custom SDK implementations.

SEE ALSO

aws(1), aws configure(1)

Copied to clipboard