से चलाते समय वसंत-क्लाउड-एस एस 3 में फ़ाइलों को रखने में सक्षम नहीं है। मैं AmazonS3Client का उपयोग कर अपने स्प्रिंग बूट ऐप के माध्यम से कुछ फ़ाइलों को एस 3 बाल्टी में रखने की कोशिश कर रहा हूं। एडब्ल्यूएस में, मैंने एक आईएएम उपयोगकर्ता (test_user1) बनाया और इस उपयोगकर्ता को एस 3 पूर्ण पहुंच अधिकार प्रदान किए। एस 3 में भी, मैंने इस उपयोगकर्ता को "s3: *" क्रियाएं दीं। उसी उपयोगकर्ता के क्रेडेंशियल क्लाउड.aws.credentials.accessKey और cloud.aws.credentials.secretKey के लिए मेरे कॉन्फ़िगरेशन फ़ाइलों में निर्दिष्ट हैं।ईसी 2
जब मैं अपने स्थानीय कंप्यूटर से ऐप चलाता हूं, तो यह ठीक काम करता है। मैं एस 3 बाल्टी में कई फाइलें डाल सकता हूं और फाइलों को देख सकता हूं। org.springframework.beans.BeanInstantiationException: org.springframework.cloud का दृष्टांत करने में विफल
की वजह से:
लेकिन, जब एक ही एप्लिकेशन एक एडब्ल्यूएस EC2 उदाहरण से चलाया जाता है, मैं आवेदन पर bellow त्रुटियों शुरू हो जाओ .aws.core.env.stack.config.StackResourceRegistryFactoryBean]: फैक्टरी विधि 'स्टैक संसाधन संसाधन रजिस्ट्रीबीन' अपवाद फेंक दिया; उपयोगकर्ता:: अर्न: एडब्ल्यूएस: नेस्टेड अपवाद com.amazonaws.AmazonServiceException है iam :: 560600000009: cloudformation: DescribeStackResources (सेवा: उपयोगकर्ता/test_user1 प्रदर्शन करने के लिए अधिकृत नहीं है AmazonCloudFormation; स्थिति कोड: 403, त्रुटि कोड: accessdenied;
?वहाँ कुछ और मैं जब EC2 उदाहरण में चल रहे कोड से S3 तक पहुँचने सेट करने के लिए है मैं अमेज़न बादल गठन उपयोग नहीं कर रहा
यहाँ है कैसे अपने प्रोजेक्ट लगता है:।
build.gradle:
compile 'org.springframework.cloud:spring-cloud-aws-autoconfigure:1.0.3.RELEASE'
compile 'org.springframework.cloud:spring-cloud-aws-context:1.0.3.RELEASE'
application.yml:
bucket: test-bucket-1
cloud.aws.credentials.accessKey: AxxxxxxxxxxxxxxA
cloud.aws.credentials.secretKey: jxxxxxxxxxxxxxxR
cloud.aws.credentials.instanceProfile: true
AmazonS3Client मेरी सेवा वर्ग में autowired है।
@Autowired
public FileService(AmazonS3Client s3Client) {..}
धन्यवाद क्रिस, यह मेरे लिए काम करता है। –