Using Amazon SES through the AWS SDK for Java - amazon-web-services

I want to send emails via an AWS account using SES in my SpringBoot application. But the issue is that I do not have the permission to generate access keys in that account. Neither can I create IAM users. I can only create and use IAM roles. But everywhere I looked mentions ways that need the access keys to be able to send emails programmatically, which I don't have. Is there any way around this?

To use the Java SES API, you do require an IAM User that has permission to use the SES Service. Then you require the access key and secret key for this IAM User. Without these values, you cannot successfully make an AWS Service call using the AWS SDK for Java.
This is mentioned in the AWS SDK for Java Developer Guide here:
Get started with the AWS SDK for Java 2.x
Update:
As you do not have the access key and secret key, you need to create a new IAM User. When you create a new IAM User, you will be given new access key and secret key values. Write these values down and use those. Also - make sure you IAM User has permission to use Amazon SES. See Create an IAM user.

Related

aws congnito user pool migration to the new account

I have total 600 users in the aws congnito user pool in my old aws account , and i want to move/migrate all the users to my new aws account. It is possible to migrate aws congnito users from one aws account to another.
Please Help Me.
I checked through every document linked to Congnito, but I was unable to find a document for moving Congnito users between AWS accounts.
You should consider to use cognito-backup-restore npm tool. It's easy to use and oriented to What you require, but there are some important points to take into account:
You need the AWS CLI and security credentials installed and well configured locally, preferably use IAM roles to access Cognito.
You're backing up users from Cognito user pool to a JSON file locally, so do it in a safe environment and remove the file after restoring the backup.
There is no way of getting passwords of the users in Cognito, so you may need to ask them to make use of ForgotPassword to recover their account.

Is there any way to get the user details from aws cognito without using AWS_KEY_ID And AWS_SECRET_KEY

Im using aws cognito and php sdk for user authentication and on website I want to list all the user names from cognito since I didn't saved the names in the database. The problem is I don't have aws key id and secret id. But i have pool id, client id and client secret key. Is there any way to fetch the details?
You need some kind of access with AWS Cognito rights. From client side you can't query all the users so you have to query them from server-side. Good part that you're using PHP SDK. If your PHP application is running on any AWS compute service like EC2 or Lambad then you don't need IAM Access Keys. You can use IAM Roles and attach the role with the services (EC2, Lambda, etc.) IAM roles behave same as Access Keys.
Sample code to list users in PHP can be found in the documentation below:
https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-cognito-idp-2016-04-18.html#listusers

Problem on creating access tokens for IAMUSER via aws educate account

I want to use aws s3 on my laravel project , for this i created a bucket on s3 and also created IAMUSER and give it "S3FullAccess" permission but it create user with some error, access_key not created...
I use my vocareum account credentails (found on Account details button) but laravel gives an error "Invalid access token".
please help...
e
On AWS Educate Starter Account you can't create access keys for IAM users. From their docs:
You can create users, but cannot associate login profile or access keys for them
The AWS Educate accounts have a lot of limitations and they just barely allow to do what you need to do in your classrooms.
It appears that the user you are logging into AWS as is not an administrator user, or certainly lacks some administration permissions.
I'm not familiar with Vocareum but it seems to be some sort of learning management system - I presume you are using an AWS account that they control, which would explain the lack of privileges. If that is the case, and it is their AWS account that you are accessing, then you will need to raise a support case with them.
If this is your account, and you created this user, then you need to log into the account as the root user you created when you configured your AWS account and use it to create an access key for this current user.

How to get service account list from AWS account using boto3?

Can someone help me to understand about service accounts ? how can we check using AWS CLI?
Here is the description from the official documentation:
An IAM user is a resource in IAM that has associated credentials and
permissions. An IAM user can represent a person or an application that
uses its credentials to make AWS requests. This is typically referred
to as a service account.
Here is the sample code
import boto3
client = boto3.client('iam',aws_access_key_id="XXX",aws_secret_access_key="XXX")
users = client.list_users()
for key in users['Users']:
print key['UserName']
The notion of a 'service account' is not an AWS thing. In IT generally, it's a user account specifically set up with long-term credentials that a server can use (as opposed to a person).
This is a bad thing. You don't ever want long-term credentials on your servers (and certainly not in your code or configuration). You should use auto-rotating credentials, such as available via IAM roles.

AWS access keys (for CLI authentication, etc..) for users from a SAML identity provider, or AD connector?

I've been looking in to getting the AWS (web) console hooked up to an AD or ADFS setup for managing users. It was reasonable easy to get working with a SAML Identity Provider in IAM and some existing ADFS infrastructure.
The problem is that users that authenticate that way, as opposed to normal AWS user accounts, don't have any way to have associated access keys so far as I can tell. Access keys are a key concept for authenticating stuff such as the AWS CLI, which needs to be tied to individual user accounts.
What are the workarounds to allow a user authenticated via a SAML identity provider to still be able to easily use the aws CLI? The only thing I've come up with to far is some hacky crap that would proxy the aws cli command, request temporary 1-hour credentials from the aws STS service, put them in the aws credentials file, and forward the command to the normal AWS cli. But, that makes me want to throw up a little bit; plus, I have no idea if it would work if a command took over an hour to complete (large s3 uploads, etc..)
Suggestions? I would try the official Directory Service AD connector, but my understanding is users still just assume IAM roles and would ultimately have the same problem.
https://github.com/Versent/saml2aws was created to address this, and has a vibrant open source community behind it.
I've had success with aws-adfs for AWS CLI via ADFS
The repo owner is currently adding support for DUO MFA as well.
It works by authenticating the user to the same page you'd use for console access then scraping the roles available. You choose a role and then aws-adfs sets the default user to the credential set needed for sts access.
After the default user is set you can cli like normal: aws s3 ls
https://github.com/venth/aws-adfs