amazon-iam

Can't access S3 bucket from within Fargate container (Bad Request and unable to locate credentials)

試著忘記壹切 提交于 2019-12-03 14:42:49
问题 I created a private s3 bucket and a fargate cluster with a simple task that attempts to read from that bucket using python 3 and boto3 . I've tried this on 2 different docker images and on one I get a ClientError from boto saying HeadObject Bad request (400) and the other I get NoCredentialsError: Unable to locate credentials . The only real different in the images is that the one saying bad request is being run normally and the other is being run manually by me via ssh to the task container.

PySpark using IAM roles to access S3

烈酒焚心 提交于 2019-12-03 14:30:13
I'm wondering if PySpark supports S3 access using IAM roles. Specifically, I have a business constraint where I have to assume an AWS role in order to access a given bucket. This is fine when using boto (as it's part of the API), but I can't find a definitive answer as to if PySpark supports this out of the box. Ideally, I'd like to be able to assume a role when running in standalone mode locally and point my SparkContext to that s3 path. I've seen that non-IAM calls usually follow : spark_conf = SparkConf().setMaster('local[*]').setAppName('MyApp') sc = SparkContext(conf=spark_conf) rdd = sc

How to call AWS API Gateway Endpoint with Cognito Id (+configuration)?

元气小坏坏 提交于 2019-12-03 12:41:19
I want to call an AWS API Gateway Endpoint that is protected with AWS_IAM using the generated JavaScript API SDK . I have a Cognito UserPool and a Cognito Identity Pool . Both properly synced via ClientId . I use this code to Sign in and get the Cognito Identity AWS.config.region = 'us-east-1'; // Region AWS.config.credentials = new AWS.CognitoIdentityCredentials({ IdentityPoolId: 'us-east-1:XXXXXXXXXXXXXXXXXXXXXXXX' // your identity pool id here }); AWSCognito.config.region = 'us-east-1'; AWSCognito.config.credentials = new AWS.CognitoIdentityCredentials({ IdentityPoolId: 'us-east-1

Connecting to AWS Transfer for SFTP

有些话、适合烂在心里 提交于 2019-12-03 11:36:11
问题 I am having trouble connecting to AWS Transfer for SFTP. I successfully set up a server and tried to connect using WinSCP. I set up an IAM role with trust relationships like follows: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "transfer.amazonaws.com" }, "Action": "sts:AssumeRole" } ] } I paired this with a scope down policy as described in the documentation using a home directory homebucket and home directory homedir { "Version": "2012-10-17",

AmazonServiceException: User is not authorized to perform: dynamodb:DescribeTable Status Code: 400; Error Code: AccessDeniedException

僤鯓⒐⒋嵵緔 提交于 2019-12-03 11:34:29
问题 I had originally thought that this issue was due to mismatching regions, but after changing the region, I'm still coming across the following error when trying out an Amazon AWS sample found here: DynamoDBMapper AmazonServiceException: User: arn:aws:sts::[My Account ARN]:assumed-role/Cognito_AndroidAppUnauth_DefaultRole/ProviderSession is not authorized to perform: dynamodb:DescribeTable on resource: arn:aws:dynamodb:us-east-1:[My Account ARN]:table/test_table (Service: AmazonDynamoDBv2;

How can we fetch IAM users, their groups and policies?

感情迁移 提交于 2019-12-03 08:41:26
I need to fetch all the aws user's, their corresponding groups, policies and then if mfa is activated for them or not. Can anyone tell me how it can be done via aws cli or boto. I have a script that fetches out just the all user's in aws. import boto3 from boto3 import * import argparse access_key = '' secret_key = '' def get_iam_uses_list(): client = boto3.client('iam', aws_access_key_id=access_key, aws_secret_access_key=secret_key) my_list=list() iam_all_users = client.list_users(MaxItems=200) for user in iam_all_users['Users']: my_list.append(user['UserName']) # for i in my_list: print i #

Terraform - assume_role_policy - similar but slightly different than standard IAM policy

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 07:42:49
This page https://www.terraform.io/docs/providers/aws/r/iam_role.html mentions: NOTE: This assume_role_policy is very similar but slightly different than just a standard IAM policy and cannot use an aws_iam_policy resource. It can however, use an aws_iam_policy_document data source, see example below for how this could work. Is there any reason why the assume_role_policy is different from the standard IAM policy ? Any why? An assume role policy is a special policy associated with a role that controls which principals (users, other roles, AWS services, etc) can "assume" the role. Assuming a

How enable access to AWS STS AssumeRole

笑着哭i 提交于 2019-12-03 05:52:29
I am getting an error when calling to assume role method of STS. It says that the user is not authorized to perform sts:AsumeRole on resource xxx . I did the following: I created a role to access to S3 bucket. I ran a test over policy simulator and works fine I created a new group, and in it, i created a new policy that enables all sts actions, over all resources. I ran a test with the policy simulator, to sts assume role, pointing to the ARN of role created at step one; and it works fine I created a new user, and put it in group created at step 3 With the credentials of the new user, i try to

AccessDeniedException: User is not authorized to perform: lambda:InvokeFunction

拥有回忆 提交于 2019-12-03 04:52:46
问题 I'm trying to invoke a lambda function from node. var aws = require('aws-sdk'); var lambda = new aws.Lambda({ accessKeyId: 'id', secretAccessKey: 'key', region: 'us-west-2' }); lambda.invoke({ FunctionName: 'test1', Payload: JSON.stringify({ key1: 'Arjun', key2: 'kom', key3: 'ath' }) }, function(err, data) { if (err) console.log(err, err.stack); else console.log(data); }); The keys are for an IAM user. The user has AWSLambdaExecute and AWSLambdaBasicExecutionRole policies attached. I get a

How to assume an AWS role from another AWS role?

一世执手 提交于 2019-12-03 04:48:12
问题 I have two AWS account - lets say A and B. In account B, I have a role defined that allow access to another role from account A. Lets call it Role-B { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::********:role/RoleA" }, "Action": "sts:AssumeRole" }] } In account A, I have defined a role that allows the root user to assume role. Lets call it Role-A { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": "arn:aws