简体   繁体   English

在特定帐户中创建s3存储桶并使用JAVA将对象放入其中的最佳实践?

[英]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.

相关问题 使用 JAVA 在 S3 存储桶上放置/读取文件 - Put/read files on S3 bucket using JAVA 使用特定帐户ID测试S3列表存储桶 - Testing S3 List bucket with particular account id 如何使用Java在AWS Lambda函数中创建S3存储桶 - How to create S3 bucket in AWS lambda function using Java 将 Java 对象存储到 Amazon S3 存储桶 - Store Java object to Amazon S3 bucket 如何使用 spring 引导 Web 应用程序将 object 放入 aws s3 存储桶 - how to put object to the aws s3 bucket using a spring boot-web application 使用 Java 从 S3 存储桶和 HTTP PUT 文件读取文件到预签名的 AWS S3 URL 以模拟实际文件上传的方式另一个存储桶 - Read a file using Java from an S3 bucket and HTTP PUT file to presigned AWS S3 URL of another bucket in a way that simulates an actual file upload Amazon SES使用Java从S3ObjectInputStream对象读取存储在s3存储桶中的电子邮件 - Amazon SES reading emails stored in an s3 bucket using java from S3ObjectInputStream object 如何在AWS S3存储桶中使用Java读取压缩的CSV文件? - How to read a zipped CSV file using Java inside an AWS S3 bucket? 如何使用AWS Java SDK从S3存储桶中的字节创建文件(如果尚不存在) - How to create File from bytes in S3 Bucket if it does not exist yet using AWS Java sdk 使用 Java (Amazon S3) 将 all.txt 文件从一个 object 复制到另一个但在同一个存储桶中 - Copy all .txt files from one object to another but in the same bucket using Java (Amazon S3)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM