Back
If you are working with EC2 or AWS Lambda or maybe any AWS IAM supported service, the secure way is to go with creating a role that has access to SES and attach it to the resource. You can give it within your program:
AWSCredentialsProvider credentialsProvider = new AWSCredentialsProvider() { @Override public void refresh() {} @Override public AWSCredentials getCredentials() { return new AWSCredentials() { @Override public String getAWSSecretKey() { return "YOUR_SECRET_KEY"; } @Override public String getAWSAccessKeyId() { return "YOUR_ACCESS_KEY"; } }; }};AmazonSimpleEmailService client = AmazonSimpleEmailServiceClientBuilder.standard() .withCredentials(credentialsProvider).build();
AWSCredentialsProvider credentialsProvider = new AWSCredentialsProvider() {
@Override
public void refresh() {}
public AWSCredentials getCredentials() {
return new AWSCredentials() {
public String getAWSSecretKey() {
return "YOUR_SECRET_KEY";
}
public String getAWSAccessKeyId() {
return "YOUR_ACCESS_KEY";
};
AmazonSimpleEmailService client = AmazonSimpleEmailServiceClientBuilder.standard()
.withCredentials(credentialsProvider).build();
Learn more about AWS by going through AWS Online training and master this technology.
Learn how we helped 50,000+ professionals like you !
31k questions
32.8k answers
501 comments
693 users