के साथ स्पार्क ईसी 2 स्क्रिप्ट चलाना मैं एक आईएएम भूमिका के तहत क्लस्टर लॉन्च करने के लिए स्पार्क ईसी 2 स्क्रिप्ट चलाने की कोशिश कर रहा हूं जो मेरे रूट खाते के तहत मेरा उपयोगकर्ता मान सकता है।आईएएम भूमिका
this JIRA ticket के अनुसार, हम अब --profile
जब स्पार्क EC2 स्क्रिप्ट चला निर्दिष्ट कर सकते हैं, और comments on the pull request का कहना है कि --profile
विकल्प क्या मैं AWSCLI प्रोफ़ाइल के रूप में विश्वास करने के लिए संदर्भित करता है।
जब मैं के रूप में
ec2/spark-ec2 -k key-name -i key-name.pem -s 1 --profile myprofile --instance-type=t2.medium launch test-cluster
स्क्रिप्ट चलाने मैं
Profile "myprofile" not found!
हालांकि
, चल
aws s3 ls s3://mybucket --profile myprofile
काम करता है के रूप में इरादा, अग्रणी मेरी IAM भूमिका में सोचने के लिए सही ढंग से निर्दिष्ट किया गया था मिल ~/.aws/config
में (मुझे नहीं लगता कि आपमें आईएएम भूमिकाएं निर्दिष्ट करते हैं 10)।
हालांकि, जब मैं ~/.aws/credentials
रूप
[foobar]
aws_secret_access_key=xxxxxxx
aws_access_key_id=xxxxxxx
स्पार्क के लिए एक परीक्षण प्रोफ़ाइल जोड़ने foobar
प्रोफ़ाइल पाता है। हालांकि, foobar
प्रोफाइल को जोड़ने के बाद
[foobar]
role_arn = arn:aws:iam::12345:role/MY_ROLE
aws_secret_access_key=xxxxxxx
aws_access_key_id=xxxxxxx
स्पार्क पाता है, लेकिन इसे सही ढंग से IAM भूमिका में प्रवेश नहीं करता है। मैं
boto.exception.EC2ResponseError: EC2ResponseError: 400 Bad Request
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>InvalidKeyPair.NotFound</Code><Message>The key pair 'key-name' does not exist</Message></Error></Errors><RequestID>fcebd475-a895-4a5b-9a29-9783fd6b7f3d</RequestID></Response>
मिल इसका कारण यह है कुंजी युग्म key-name
मेरे उपयोगकर्ता के तहत अस्तित्व में नहीं है, लेकिन यह IAM भूमिका मुझे लगता है की जरूरत के तहत मौजूद है। यह मुझे बताता है कि स्पार्क आईएएम भूमिका में ठीक से लॉग इन नहीं कर रहा है।
मेरे ~/.aws/config
:
[default]
region = us-east-1
aws_secret_access_key = xxxxx
aws_access_key_id = xxxxx
[profile myprofile]
role_arn = arn:aws:iam::12345:role/MY_ROLE
source_profile = default
मेरे ~/.aws/credentials
:
[default]
aws_secret_access_key = xxxxx
aws_access_key_id = xxxxx
साइड भी कोशिश की नोट-:
एक
aws sts assume-role --role-arn arn:aws:iam::12345:role/MY_ROLE --role-session-name temp-session
तो AWS_SECRET_ACCESS_KEY
, AWS_SESSION_TOKEN
, और AWS_ACCESS_KEY_ID
वातावरण चर के लिए निर्यात के साथ मैन्युअल रूप से भूमिका ssuming। मैं तो विनिर्दिष्ट किसी प्रोफ़ाइल के बिना EC2 लिपियों भाग गया और मिल गया
boto.exception.EC2ResponseError: EC2ResponseError: 401 Unauthorized
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>AuthFailure</Code><Message>AWS was not able to validate the provided access credentials</Message></Error></Errors><RequestID>11402f6e-074c-478c-84c1-11fb92ad0bff</RequestID></Response>
साइड भी कोशिश की नोट-:
this JIRA on Spark scripts with IAM roles के अनुसार, हम --instance-profile-name
(एक उदाहरण प्रोफ़ाइल है निर्दिष्ट कर सकते हैं इस तरह एक आईएएम भूमिका का उपयोग करने का एकमात्र तरीका? यानी .. क्या मुझे आईएएम सूची के लिए हमारे व्यवस्थापक से पूछना होगा/आईएएम भूमिका के साथ क्लस्टर लॉन्च करने के लिए अनुमतियां बनाना होगा?)। मैं arn:aws:iam::12345:role/MY_ROLE
और MY_ROLE
लेकिन
boto.exception.EC2ResponseError: EC2ResponseError: 400 Bad Request
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>InvalidParameterValue</Code><Message>Value (arn:aws:iam::12345:role/MY_ROLE) for parameter iamInstanceProfile.name is invalid. Invalid IAM Instance Profile name</Message></Error></Errors><RequestID>ffeffef9-acad-4a34-a925-31f6b5bbbb3e</RequestID></Response>