如何在Elastic Beanstalk上为Amazon SES传递AWS_ACCESS_KEY_ID? [英] How do I pass AWS_ACCESS_KEY_ID for Amazon SES on Elastic Beanstalk?
问题描述
我在本地计算机中将AWS_ACCESS_KEY_ID
和AWS_SECRET_ACCESS_KEY
设置为环境变量,并且工作正常.当我部署到Elastic Beanstalk时,我设置了环境属性",但是它们作为-D
Java系统属性而不是设置为环境变量进行传递,并且会生成错误.
I set the AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
as environment variables in my local computer and it works fine. When I deploy to Elastic Beanstalk, I set the "Environment properties", but they are passed as -D
Java system properties, not set as environment variables, and it generates an error.
而Tomcat平台设置您使用System.getProperty检索的Java系统属性.
while the Tomcat platform sets Java system properties that you retrieve with System.getProperty.
错误
2018-08-03 02:34:37.001信息32073 --- [nio-8080-exec-9] c.s.xxxxx.apis.XxxxxxxApiController:未发送电子邮件.错误:用户'arn:aws:sts :: 849611986161:assumed-role/aws-elasticbeanstalk-ec2-role/i-0f447c52c84e1fd93'无权对资源'arn:aws:ses:us-执行'ses:SendEmail' east-1:849611986161:identity/xxxxxx@xxxxx.com'(服务:AmazonSimpleEmailService;状态代码:403;错误代码:AccessDenied;请求ID:c3835dda-96c5-11e8-8a21-67774160691b)
2018-08-03 02:34:37.001 INFO 32073 --- [nio-8080-exec-9] c.s.xxxxx.apis.XxxxxxxApiController : The email was not sent. Error: User 'arn:aws:sts::849611986161:assumed-role/aws-elasticbeanstalk-ec2-role/i-0f447c52c84e1fd93' is not authorized to perform 'ses:SendEmail' on resource 'arn:aws:ses:us-east-1:849611986161:identity/xxxxxx@xxxxx.com' (Service: AmazonSimpleEmailService; Status Code: 403; Error Code: AccessDenied; Request ID: c3835dda-96c5-11e8-8a21-67774160691b)
Amazon SES仅期望环境变量(或主目录中的共享凭证文件").那么,如何使用该环境将AWS密钥传递给用于Java Spring Boot应用程序的Elastic Beanstalk中的Amazon SES?
Amazon SES is expecting environment variables only (or a 'shared credential file' in your home directory). So how do I pass AWS keys to Amazon SES in Elastic Beanstalk for a Java Spring Boot application using the environment?