Use ResendValidationEmail with an AWS SDK or CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use ResendValidationEmail with an AWS SDK or CLI

The following code examples show how to use ResendValidationEmail.

Action examples are code excerpts from larger programs and must be run in context. You can see this action in context in the following code example:

C++
SDK for C++
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

//! Resend the email that requests domain ownership validation. /*! \param certificateArn: The Amazon Resource Name (ARN) of a certificate. \param domainName: A fully qualified domain name. \param validationDomain: The base validation domain that will act as the suffix of the email addresses. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::ACM::resendValidationEmail(const Aws::String &certificateArn, const Aws::String &domainName, const Aws::String &validationDomain, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::ACM::ACMClient acmClient(clientConfiguration); Aws::ACM::Model::ResendValidationEmailRequest request; request.WithCertificateArn(certificateArn) .WithDomain(domainName) .WithValidationDomain(validationDomain); Aws::ACM::Model::ResendValidationEmailOutcome outcome = acmClient.ResendValidationEmail(request); if (!outcome.IsSuccess()) { std::cerr << "ResendValidationEmail error: " << outcome.GetError().GetMessage() << std::endl; return false; } else { std::cout << "Success: The validation email has been resent." << std::endl; return true; } }
CLI
AWS CLI

To resend validation email for your ACM certificate request

The following resend-validation-email command tells the Amazon certificate authority to send validation email to the appropriate addresses:

aws acm resend-validation-email --certificate-arn arn:aws:acm:region:account:certificate/12345678-1234-1234-1234-123456789012 --domain www.example.com --validation-domain example.com
PowerShell
Tools for PowerShell

Example 1: Requests that the email to validate domain ownership for 'www.example.com' be sent. If your shell's $ConfirmPreference is set to 'Medium' or lower, the cmdlet will prompt for confirmation before proceeeding. Add the -Force switch to suppress confirmation prompts.

$params = @{ CertificateArn="arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012" Domain="www.example.com" ValidationDomain="example.com" } Send-ACMValidationEmail @params
Python
SDK for Python (Boto3)
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

class AcmCertificate: """ Encapsulates ACM functions. """ def __init__(self, acm_client): """ :param acm_client: A Boto3 ACM client. """ self.acm_client = acm_client def resend_validation_email(self, certificate_arn, domain, validation_domain): """ Request that validation email is sent again, for a certificate that was previously requested with email validation. :param certificate_arn: The ARN of the certificate. :param domain: The primary domain of the certificate. :param validation_domain: Alternate domain to use for determining email addresses to use for validation. """ try: self.acm_client.resend_validation_email( CertificateArn=certificate_arn, Domain=domain, ValidationDomain=validation_domain, ) logger.info( "Validation email resent to validation domain %s.", validation_domain ) except ClientError: logger.exception( "Couldn't resend validation email to %s.", validation_domain ) raise