[英]Best practice to create a s3 bucket in a particular account and put object inside it using JAVA?
I am doing a project where I have to measure reliability of a service. 我正在做一个项目,我必须测量服务的可靠性。 I have a Producer/Consumer setup to do that.
我有一个生产者/消费者设置来做到这一点。 In my consumer side I am receiving events and each event has a unique eventID.
在我的用户方面,我正在接收事件,每个事件都有一个唯一的eventID。 As I have all the eventID's for the events which are published by the producer.
因为我拥有生产者发布的事件的所有eventID。 My approach is to write all the eventID's for the events received at consumer side and write it to a s3 bucket.
我的方法是为在消费者方接收到的事件编写所有eventID,并将其写入s3存储桶。 I found this example here but I have few doubts so here are my questions:
我在这里找到了这个示例,但我对此几乎没有疑问,所以这是我的问题:
1- How does my java code will know in which AWS account it needs to create a s3 Bucket? 1-我的Java代码如何知道需要在哪个AWS账户中创建s3存储桶?
2- I want to write data for a day and save it everyday, so how to do that? 2-我要写一天的数据并每天保存,那么该怎么做呢?
Let me know if you need any other information from my side? 让我知道您是否需要我身边的其他信息?
1- How does my java code will know in which AWS account it needs to create a s3 Bucket?
1-我的Java代码如何知道需要在哪个AWS账户中创建s3存储桶?
Have a look at the documentation and see the implementation classes. 查看文档并查看实现类。 They all provide different options how the account credentials can be specified.
它们都提供了如何指定帐户凭据的不同选项。
The ProfileCredentialsProvider will use the profile configuation in ~/.aws/credentials
file ProfileCredentialsProvider将使用
~/.aws/credentials
文件中的配置文件配置
2- I want to write data for a day and save it everyday, so how to do that?
2-我要写一天的数据并每天保存,那么该怎么做呢?
I am not sure what you want from the description, here I will assume you want to gather events for a whole day and write the whole set into the S3 bucket (do not create butckets dynamically, number of buckets is limited) 我不确定您要从描述中得到什么,在这里我将假定您要收集一整天的事件并将整个集合写入S3存储桶(请勿动态创建存储桶,存储桶数量有限)
you cannot update an S3 object. 您无法更新S3对象。 So using pure S3 you could eg create a folder (s3 key prefix) for each day and and store each event as an object
因此,使用纯S3,您可以例如每天创建一个文件夹(s3键前缀)并将每个事件存储为一个对象
If you want to have an aggregated list for each day, you will need to store data somewhere else for the day (eg DynamoDB, CloudWatch,..) and export logs into the S3 object daily (eg for DynamoDB you could create a Data Pipeline or a Lambda function to export data into an S3 bucket) 如果您希望每天都有汇总列表,则需要将数据当天存储在其他地方(例如DynamoDB,CloudWatch等),然后每天将日志导出到S3对象中(例如,对于DynamoDB,您可以创建数据管道)或Lambda函数将数据导出到S3存储桶中)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.