Aws consloe enable gmail port for send mail
To enable Gmail as a mail server for sending emails from the AWS CLI, you'll need to follow these steps:
Step 1: Enable Less Secure Apps on your Gmail account
- Go to your Google Account settings.
- Click on "Security" from the left-hand menu.
- Scroll down to the "Less secure app access" section.
- Toggle the switch to "On".
Step 2: Configure your AWS CLI to use Gmail
-
Open your AWS CLI configuration file (
~/.aws/credentials
on Linux/macOS or%USERPROFILE%\.aws\credentials
on Windows) and add the following lines:[default] aws_access_key_id = YOUR_ACCESS_KEY_ID aws_secret_access_key = YOUR_SECRET_ACCESS_KEY
Replace
YOUR_ACCESS_KEY_ID
andYOUR_SECRET_ACCESS_KEY
with your actual AWS access key ID and secret access key. -
Create a new file called
~/.aws/config
(on Linux/macOS) or%USERPROFILE%\.aws\config
(on Windows) and add the following lines:[default] region = YOUR_REGION email = YOUR_GMAIL_EMAIL_ADDRESS
Replace
YOUR_REGION
with the region you want to use (e.g.,us-west-2
) andYOUR_GMAIL_EMAIL_ADDRESS
with your Gmail address.
Step 3: Configure the AWS CLI to use Gmail as a mail server
- Run the following command to configure the AWS CLI to use Gmail as a mail server:
aws configure set email.use-ssl true aws configure set email.smtp-server smtp.gmail.com aws configure set email.smtp-port 587 aws configure set email.smtp-username YOUR_GMAIL_EMAIL_ADDRESS aws configure set email.smtp-password YOUR_GMAIL_PASSWORD
Replace
YOUR_GMAIL_EMAIL_ADDRESS
andYOUR_GMAIL_PASSWORD
with your Gmail address and password, respectively.
Step 4: Test your setup
- Run the following command to test your setup:
aws sns publish --topic-arn YOUR_TOPIC_ARN --message "Hello, world!"
Replace
YOUR_TOPIC_ARN
with the ARN of the SNS topic you want to publish to.
If everything is set up correctly, you should receive an email from AWS with the message "Hello, world!".
That's it! You should now be able to send emails from the AWS CLI using your Gmail account.