简体   繁体   中英

Configuration in a S3 bucket: bad idea?

I'm quite new in AWS. I have designed an architecture that uses Api Gateway to call a lambda function written in java. Since I have some configuration I decided to create an S3 file to store a standard Java configuration file there and load it when needed. This took a lot of time, about 15 sec, for a very small file. To read the file I'm using AmazonS3Client client class, Do I have other options?

 long ms = System.nanoTime();
        AmazonS3Client client = new AmazonS3Client(new DefaultAWSCredentialsProviderChain());
        GetObjectRequest request = new GetObjectRequest("bucket","filepath");
        InputStream inputStream = client.getObject(request).getObjectContent();
        try {
            PropertiesConfiguration p = new PropertiesConfiguration();
            p.load(inputStream);
            composite.addConfiguration(p);
            log.debug(String.format("Configuration read in %f mS",(System.nanoTime()-ms)/1000000f));

        }catch (ConfigurationException e) {
            logger.error("error reading configuration on S3:"+e);

        }

So the questions: if storing the config file in an s3 bucket is a bad idea, where is supposed to be stored a configuration? Is that performance normal? I'm thinking in using s3 a lot in my architecture for something else, but having a 15 sec handshake for a file is, of course, unacceptable.

In this case I think you should try to store it with EBS . But it will cost you more because EBS is optimized I/O and EBS storage is organized into volumes and once an EBS volume is attached to a server it is treated like a local disk drive.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM