除了我从一个现有的应用程序开始,我在教程中有一个Dockerfile并且docker-compose.yml喜欢.
我docker-compose.yml看起来像:
db:
image: postgres
ports:
- "5432"
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- .:/myapp
ports:
- "3030:3030"
links:
- db
Run Code Online (Sandbox Code Playgroud)
并且Dockerfile:
FROM ruby:2.1.4
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
RUN mkdir /myapp
WORKDIR /myapp
ADD Gemfile /myapp/Gemfile
RUN bundle install
ADD . /myapp
# RUN bundle exec rake db:create
# RUN bundle exec rake db:migrate
# …Run Code Online (Sandbox Code Playgroud) 我正在使用自定义身份验证(使用自定义授权程序)来访问AWS lambda.授权过程正常.但是我在授权者lambda和业务lambda之间传输数据(ex principalId)时遇到了问题.我所有的lambdas都是用JS开发的.正如AWS doc中的解释,在授权器lambda中,我在Auth响应的上下文字段中添加了几个简单的字段(下面的代码中的principalId).但在我的业务lambda中,我无法获得这些领域.AWS文档讨论了$ context变量.
首先,如果$ context变量是另一个变量或者与JS函数参数中接收的上下文变量相同的变量,你能解释一下吗?
第二,你能解释一下如何让我的业务lambda获得授权人提供的数据字段(例如:principalId)吗?
勒布
我想从电子邮件中提取附件并将其保存到我的新S3存储桶中.到目前为止,我已配置AWS Simple Email Service来拦截传入的电子邮件.现在我有一个AWS lambda python函数,它在S3 Put上被触发.
在此之前它正在发挥作用.但我的lambda提出错误说:"[Errno 2]没有这样的文件或目录:'abc.docx':OSError".我看到在S3中的原始电子邮件中提到了名为abc.docx的附件.
我假设问题出在我的upload_file中.你能帮帮我吗?
请在下面找到我的代码的相关部分.
s3 = boto3.client('s3')
s3resource = boto3.resource('s3')
waiterFlg = s3.get_waiter('object_exists')
waiterFlg.wait(Bucket=bucket, Key=key)
response = s3resource.Bucket(bucket).Object(key)
message = email.message_from_string(response.get()["Body"].read())
if len(message.get_payload()) == 2:
attachment = msg.get_payload()[1]
s3resource.meta.client.upload_file(attachment.get_filename(), outputBucket, attachment.get_filename())
else:
print("Could not see file/attachment.")
Run Code Online (Sandbox Code Playgroud) 我有一台在 aws 弹性 beantalk 上运行的服务器。已经很不错了。但是今天在应用更新时(与所使用的模块的配置或版本控制完全无关),这只是在网络应用程序中的某些文本中添加几个单词(字面意思是“狗”这个词)。该应用程序因 502 nginx 网关错误而开始崩溃。我认为这是因为该应用程序没有吸引力。我去了并恢复了更改(虽然我认为我不必这样做)。并且问题仍然存在。
我尝试提升/启动风帆应用程序时的输出如下。
Failed to load helper `web/auth/validate-user-password` as a machine!
A hook (`helpers`) failed to load!
Failed to lift app: ImplementationError: Sorry, could not interpret "web/auth/validate-user-password" because its underlying implementation has a problem:
------------------------------------------------------
• The `cacheable` property is no longer supported. (Please use `sideEffects: 'cacheable' instead.)
------------------------------------------------------
If you are the maintainer of "web/auth/validate-user-password", then you can change its implementation to solve the problem above. Otherwise, please file a bug report with …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个lambda脚本,可以从站点中提取图像并将其存储在S3中.我遇到的问题是什么样的对象作为Body属性传递给S3.putObject方法.在这里的文档中它说它应该是new Buffer('...') || 'STRING_VALUE' || streamObject,但我不知道如何将https响应转换为其中之一.这是我尝试过的:
var AWS = require('aws-sdk');
var https = require('https');
var Readable = require('stream').Readable;
var s3 = new AWS.S3();
var fs = require('fs');
var url = 'https://upload.wikimedia.org/wikipedia/commons/thumb/1/1d/AmazonWebservices_Logo.svg/500px-AmazonWebservices_Logo.svg.png';
exports.handler = function(event, context) {
https.get(url, function(response) {
var params = {
Bucket: 'example',
Key: 'aws-logo.png',
Body: response // fs.createReadStream(response); doesn't work, arg should be a path to a file...
// just putting response errors out with "Cannot determine length of [object Object]" …Run Code Online (Sandbox Code Playgroud) aws-lambda ×3
amazon-s3 ×2
node.js ×2
aws-sdk ×1
boto3 ×1
docker ×1
javascript ×1
nginx ×1
sails.js ×1