问题标签 [localstack]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c# - Using AWS SDK on .net with localstack (TransferUtility/S3 - setting endpoint)
I have localstack (https://github.com/localstack/localstack) running and am able to use the aws s3 cli to upload files to it.
What I want to be able to do is use the .NET AWS ADK with localstack. I'd like the following code to upload a file into localstack:
My problem is I don't know how to set the endpoints so that localstack is used by the SDK rather than aws. Apparently you can set the AWSEndpointDefinition
in appSettings.config as mentioned in the AWS SDK documentation, e.g:
<add key="AWSEndpointDefinition" value="C:\Dev\localstack\endpoints.json"/>
However I have no idea what this endpoints.json config should look like. I tried using this file:
https://raw.githubusercontent.com/aws/aws-sdk-net/master/sdk/src/Core/endpoints.json
When I do this, as soon as I new up a TransferUtility
class I get a null reference exception - this is before I point anything to my localstack setup.
The version of AWS ASK is 3.3.0.
Another thing to note is that in some places in the documentation it is implied that the config should be an xml file rather than a json, however, when I try to use an xml file instead I get a different exception when newing up TransferUtility
: 'Invalid character '<' in input string'
amazon-web-services - AWS SNS HTTP 订阅未调用端点
我已经在我的开发机器中使用Localstack部署了 AWS SNS ,现在我正在尝试使用我从awslocal
CLI 发出的消息(基本上它是aws
针对我的本地 Localstack 基础架构的)
首先,我创建了一个主题:
然后,我针对以下内容创建了一个 HTTP 订阅http://localhost:8080/sns/publish
:
我有一个localhost
在端口上运行的服务器,8080
带有一个 POST/sns/publish
端点。应该调用它以确认订阅。但它从来没有被调用过。
我有一些线索。我已经使用 Docker 部署了 Localstack。检查容器日志后,我看到了这个错误:
HTTP ERROR 405 对应于 Method Not Allowed 错误,因此它可能正在尝试调用容器端点而不是我的主机的端点。
我该如何解决这个问题?
amazon-web-services - 我们如何在 docker 上运行 Neptune 图形数据库
我们如何在 docker 上运行 Neptune 图形数据库
由于 Neptune DB 最近已经产品化,它在 Localstack 上不可用,有人可以指导我如何将 AWS Neptune DB 服务部署到 docker 容器中
docker - 我无法从使用 docker 运行的 localstack 获取 dynamoDB 表列表
我在 docker 容器中安装了 localstack 和 awscli。我运行不同的 aws 命令来列出流和存储桶,但是当我尝试列出 dynamoDB 表时(如下所示),它失败了:
这是我得到的错误:
我没有在互联网上找到任何解决我问题的回复。
如果有人有线索或想法,我将不胜感激。
提前致谢
amazon-web-services - 来自 localstack 的 SNS 通知中缺少 MessageId
对于使用 AWS 服务进行本地开发,我使用的是localstack。现在我想使用 SNS,当我发布消息时,订阅者没有收到“元数据”(如 MessageId、TopicArn、Timestamp)
我已经采取了以下步骤:
启动 docker 容器:
/li>创建了一个 SNS 主题:
/li>订阅主题:
/li>最后,我发布了一条消息:
/li>
订阅者成功收到消息,但缺少“messageId”、“Timestamp”和“TopicArn”:
实际结果:
预期结果:
我究竟做错了什么?以及如何确保消息确实获得了这些信息?
docker - 在 docker 镜像中连接到 docker 的主机网络
我有一个 docker-compose 堆栈一起运行多个图像。
一旦我有了 docker 堆栈,我就会运行一个本地堆栈和一个 mongo。在 Local-stack 中,如果要执行 lambda,则会启动一个新的 docker 映像。从 lambda 图像我需要连接到现有堆栈中的 mongo 图像。
docker.sock 访问权限已经提供给本地堆栈,因此它会在我的主机中创建一个新的 docker 映像。现在从 lambda 到 mongo 没有建立到网络的连接。既不是通过应用环回地址也不是通过 docker-compose.yml 中提到的网络别名
你能帮我如何建立连接...?
更新
我的 docker-compose.yml
我的 localstack-config.list
amazon-web-services - AWS S3 获取对象版本返回错误代码:500 内部服务器错误
检索在 Localstack (docker) 上运行的 S3 中存储的对象版本时出现以下错误:
com.amazonaws.services.s3.model.AmazonS3Exception:内部服务器错误(服务:Amazon S3;状态代码:500;错误代码:500 内部服务器错误;请求 ID:空),S3 扩展请求 ID:空
我已经使用 aws-java-sdk 的 1.11.163、1.11.359、1.11.383 版本进行了测试。
列出和删除文件有效,但我无法使用 SDK 获取版本。
问题是,当使用 cli 时,我可以在我的存储桶中列出对象的版本。
列出我的存储桶中文件的版本时:
aws --endpoint-url= http://localhost:4572 s3api list-object-versions --bucket my-bucket --prefix testFolder
我得到以下输出:
这是我创建 S3Configuration 的方法:
以下是我创建 AmazonS3 客户端的方法:
每当我尝试使用以下命令列出存储桶中文件的版本时,就会发生异常:
或尝试获取特定文件的版本:
从 S3ObjectSummary.getKey() 中检索 objectKey
知道我缺少什么吗?
谢谢你的帮助。
amazon-web-services - 无法通过 aws cli 从 localstack 调用 lambda 函数
我已经推送了 lambda 函数,正如我在 localstack 中看到的那样,基于以下命令/输出
当我尝试执行它时,如下所示,我收到一个错误,我的 localstack 正在一个 docker 容器中运行
aws --endpoint-url= http://localhost:4574 lambda 调用 --function-name books1 /tmp/output.json
这个 lambda 是编写的Go
,当我在真正的 AWS 上手动执行它时,它工作得很好。
java - Testing Localstack AWS with Apache Camel
I'm trying to leverage localstack to do local AWS mock testing. Specifically, I'd like to download a file from a localstack S3 bucket by using an Apache Camel S3 route. However, I am running into errors. Here are the steps I've taken...
I've created a test localstack S3 bucket by entering...
Then, I uploaded a test file to this bucket...
Both operations completed successfully. In my Java code, I've created a CDI Producer to produce a com.amazonaws.services.s3.AmazonS3 client object...
Finally, I created a Camel route designed to download the contents of mytestbucket into a local directory...
However, when my application starts up and attempts to run the route, I get the following Exception:
Caused by: org.jboss.weld.exceptions.DeploymentException: Failed to create route s3test: Route(s3test)[[From[aws-s3://arn:aws:s3:::mytestbucket?amazo... because of Unable to execute HTTP request: mytestbucket.localhost at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:38) at org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl.fire(AfterDeploymentValidationImpl.java:28) at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:499) at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:93) at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:97) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1736) at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1698) ... 6 more Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route s3test: Route(s3test)[[From[aws-s3://arn:aws:s3:::mytestbucket?amazo... because of Unable to execute HTTP request: mytestbucket.localhost at org.apache.camel.impl.RouteService.warmUp(RouteService.java:147) at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:3949) at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3856) at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3642) at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3494) at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:209) at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3253) at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3249) at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3272) at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3249) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3165) at org.apache.camel.impl.DefaultCamelContext$Proxy$_$$_WeldClientProxy.start(Unknown Source) at org.apache.camel.cdi.CdiCamelExtension.afterDeploymentValidation(CdiCamelExtension.java:425) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:95) at org.jboss.weld.injection.MethodInvocationStrategy$SpecialParamPlusBeanManagerStrategy.invoke(MethodInvocationStrategy.java:144) at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:330) at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:123) at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:308) at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:286) at org.jboss.weld.util.Observers.notify(Observers.java:172) at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:285) at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:273) at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:177) at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:171) at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:53) at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:35) ... 12 more Caused by: com.amazonaws.SdkClientException: Unable to execute HTTP request: mytestbucket.localhost at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleRetryableException(AmazonHttpClient.java:1114) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1064) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:743) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:717) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667) at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513) at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4330) at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4277) at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4271) at com.amazonaws.services.s3.AmazonS3Client.listObjects(AmazonS3Client.java:835) at org.apache.camel.component.aws.s3.S3Endpoint.doStart(S3Endpoint.java:112) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) at org.apache.camel.impl.RouteService.doWarmUp(RouteService.java:157) at org.apache.camel.impl.RouteService.warmUp(RouteService.java:145) ... 42 more Caused by: java.net.UnknownHostException: mytestbucket.localhost at java.net.InetAddress.getAllByName0(InetAddress.java:1280) at java.net.InetAddress.getAllByName(InetAddress.java:1192) at java.net.InetAddress.getAllByName(InetAddress.java:1126) at com.amazonaws.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:27) at com.amazonaws.http.DelegatingDnsResolver.resolve(DelegatingDnsResolver.java:38) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:111) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.amazonaws.http.conn.ClientConnectionManagerFactory$Handler.invoke(ClientConnectionManagerFactory.java:76) at com.amazonaws.http.conn.$Proxy246.connect(Unknown Source) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55) at com.amazonaws.http.apache.client.impl.SdkHttpClient.execute(SdkHttpClient.java:72) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1236) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1056) ... 57 more
I thought that since my AmazonS3
client specifically indicates that http://localhost:4572
is my endpoint then it should not reach out to the actual S3 service. That seems to be the case, but for some reason it is trying to access mytestbucket.localhost
as if it were a network host. Any idea what I could be doing wrong here or why this route/configuration isn't working?
amazon-web-services - 使用 localstack 运行 lambda 函数
我尝试使用 localstack 运行我的 lambda 函数。我安装了 awscli-local 和 localstack
pip3 安装 awscli-local
pip3 install --user localstack --ignore-installed 六
然后我开始了 localstack
LAMDBA_EXECUTOR=docker localstack start --docker
当我现在想创建我的 lambda 函数时
aws lambda create-function --function-name Test --zip-file fileb://myLambda.zip --handler index.handler --runtime 'nodejs6.10' --endpoint http://localhost:4574 --role行政
我收到这个错误
调用 CreateFunction 操作时发生错误(ResourceConflictException):函数已存在:测试
列出函数不会返回任何内容
aws lambda list-functions --endpoint http://localhost:4574
有人知道为什么 localstack 认为该功能已经存在吗?