我们有多个 S3 存储桶,其中一些已启用 s3 版本控制,有些已禁用。如何知道哪个存储桶启用了版本控制?
当 S3-bucket(主文件夹)启用版本控制时,是否可以在子对象(子文件夹)上禁用 s3 版本控制?
我希望有人能提供帮助,我已经让AWS Lambda在context.succeed或context.fail中返回了一些XML,除了一小部分外,一切都很好.我回应了XML,但因为标题仍然存在Content-Type: application/json而我正在谈论的Twilio服务器正在查看并拒绝它,即使正文实际上是有效的XML.
有没有办法覆盖标题?
非常感谢.
我在 API 网关(身份验证:AWS_IAM)下设置了一个 GET 方法,并且有一个带有开发人员身份的 Cognito 池。我在 get 方法后面有一个 lambda。
当我调用 Cognito 时,我会获得临时凭证并承担一个角色。我担任的角色具有在 API 网关上执行和访问所有内容的适当权限。
...
{
"Effect": "Allow",
"Action": [
"execute-api:Invoke"
],
"Resource": [
"*"
]
},
{
"Effect": "Allow",
"Action": [
"apigateway:GET"
],
"Resource": [
"*"
]
}
...
Run Code Online (Sandbox Code Playgroud)
当我使用此设置调用 API 网关时,我收到 500,内部服务器错误。
如果我从策略中删除上述 API 网关权限,那么我会得到 403 error forbidden (User: arn:aws:sts::xxxxx:assumed-role/Cogn_Auth_Role/xxx is not authorized to perform: execute-api:Invoke on resource: arn:aws:execute-api:us-east-1:xxxx:xxx/xxx/GET/events
如果我去并将 附加AdminAccess到这个角色,那么一切正常。这里有什么交易?我错过了什么吗?
amazon-web-services amazon-iam amazon-cognito aws-lambda aws-api-gateway
我正在使用以下AWS技术构建无服务器后端:
在api_gateway中,我创建了一个Cognito用户池授权程序,我使用此授权程序来处理对后端的所有请求.
一切正常:当用户使用无效的JWT令牌发出请求时,服务器会相应地做出响应.有效的JWT令牌执行请求的Lambda函数.
问题:我无法检索identity信息,如accessKey,accountId,cognitoIdentityId等等.所有这些变量都是null我通过contextlambda函数中的对象访问它们的时候
问题:为了获得identity变量,我需要做什么?
我正在尝试为使用AWS Lambda的应用程序编写无服务器后端,并且遇到标题中的错误。使用API Gateway代理集成进行测试时会发生错误,但是在Lambda控制台中进行测试时,该功能可以正常工作。
这是错误:
{
"errorMessage":"string indices must be integers",
"errorType":"TypeError",
"stackTrace":[
[
"/var/task/auth_login.py",
17,
"lambda_handler",
"response = get_user(payload)"
],
[
"/var/task/shifty_utils/__init__.py",
22,
"get_user",
"table = dynamo.Table(user['company'] + '_users')"
]
]
}
Run Code Online (Sandbox Code Playgroud)
这是发生情况的上下文:
def lambda_handler(event, context):
payload = event['body']
response = get_user(payload)
def get_user(user):
try:
table = dynamo.Table(user['company'] + '_users')
response = table.get_item(
Key={
'userId': user['userId'],
'position': user['position']
}
)
except ClientError as e:
print(e.response['Error']['Message'])
return {'message': e.response['Error']['Message']}
else:
return response
Run Code Online (Sandbox Code Playgroud)
基本上,代理集成似乎是以JSON格式的字符串而不是dict的形式读取事件对象,但是如果我为此调整代码,就会发生以下情况:
{
"errorMessage":"the JSON object must be str, bytes …Run Code Online (Sandbox Code Playgroud) 我想知道 API GateWay 是否有可能将数据发送到特定的 EC2 实例(我的服务器)?
以及我的服务器(在 Java 中运行代码)应该如何从网关获取数据?
谢谢你,诺法尔。
我试过搜索,但我的 googlefu 失败了。
我有一个基本的 python lambda 函数:
def lambda_handler(event, context):
foo = event['bar']
print(foo)
Run Code Online (Sandbox Code Playgroud)
然后我尝试做一个 POST,像这样在 curl 中:
curl -X POST https://correctaddress.amazonaws.com/production/test \
-H 'x-api-key: CORRECTKEY' \
-H 'content-type: application/json' \
-H 'bar: Hello World' \
Run Code Online (Sandbox Code Playgroud)
这KeyError: 'bar'可能失败了,因为我认为我作为 event['bar'] 传递的不是这样传递的。
我试过event['body']['bar']也失败了。
如果我这样做event['querystringparameters']['bar'],如果我使用 GET 会起作用,例如:
curl -X POST https://correctaddress.amazonaws.com/production/test?bar=HelloWorld -H 'x-api-key: CORRECTKEY'
Run Code Online (Sandbox Code Playgroud)
我知道我缺少关于事件字典的一些基本知识,以及它从 POST 中提取的内容,但我似乎找不到正确的文档(不确定它是否会出现在 API 或 Lambda 的文档中)。
我的最终目标是能够使用像这样的请求在 python 中写一些东西:
import requests, json
url = "https://correctaddress.amazonaws.com/production/test"
headers = {'Content-Type': "application/json", 'x-api-key': "CORRECTKEY"}
data …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用适用于 React Native 的 AWS Amplify SDK 和 API Gateway 中的 IAM 授权程序发出一个简单的获取请求。我总是收到以下错误消息:
凭证的范围应限定为有效区域,而不是“us-east-1”。
我究竟做错了什么?这是我的代码(还没有做任何事情):
function getImageIdForUpload() {
let apiName = 'MyAPIGatewayAPI';
let path = '/upload-image/get-new-id';
let myInit = {
// replace this with attributes you need
};
API.get(apiName, path, myInit).then(response => {
console.log(response)
}).catch(error => {
console.error(error.response)
});
}
Run Code Online (Sandbox Code Playgroud)
我的配置:
Auth: {
// REQUIRED - Amazon Cognito Identity Pool ID
identityPoolId: 'eu-central-1:xxxx',
// REQUIRED - Amazon Cognito Region
region: 'eu-central-1',
// OPTIONAL - Amazon Cognito User Pool ID
userPoolId: …Run Code Online (Sandbox Code Playgroud) amazon-web-services amazon-iam react-native aws-api-gateway aws-amplify
当我在 RDS MySQL VPC 中移动我的 AWS Lambda 函数时,API Gateway 无法调用它并超时。是否可以从 API Gateway 调用 VPC Lambda?
VPC 链接不能使用应用程序负载均衡器创建,这是 Lambda 函数的唯一选择,它们需要网络负载均衡器。
我正在尝试使用无服务器框架部署 lambda 函数,部署成功但我无法看到 lambda 函数的 api 网关,并且部署后没有创建端点,我在下面发布代码
无服务器.yml
# Welcome to Serverless!
#
# This file is the main config file for your service.
# It's very minimal at this point and uses default values.
# You can always add more config options for more control.
# We've included some commented out config examples here.
# Just uncomment any of them to get that config option.
#
# For full config options, check the docs:
# docs.serverless.com
#
# Happy …Run Code Online (Sandbox Code Playgroud) aws-api-gateway ×10
aws-lambda ×6
amazon-iam ×2
python ×2
amazon-s3 ×1
aws-amplify ×1
aws-cognito ×1
node.js ×1
react-native ×1
twilio ×1