Coder Social home page Coder Social logo

aws-client-auth's Introduction

aws-client-auth

Creates an authenticated client which is allowed to use the selected service REST API. The following is the application class diagram:

class diagram

📝 You need to set up your AWS user's security credentials to be able to use the service REST API.

You do this by creating a file named credentials in the ~/.aws/ on Mac (*C:\Users\USER_NAME.aws* on Windows) and saving the following lines in the file:

[default]
	aws_access_key_id = your access key
	aws_secret_access_key = your secret key

For more information, see Providing AWS Credentials in the AWS SDK for Java and Welcome to Identity and Access Management.

🚨 To avoid accidental leakage of your credentials, DO NOT keep the credentials file in your source directory.

📝 At his time the application only provides authentication for EC2 and S3. New service authentication will be added.

Create AWS Access Credentials

To access Amazon Web Services, you need an AWS account and AWS credentials. To increase the security of your AWS account, it is recommended to use an Identity Access Management (IAM) user to provide access credentials instead of using your root account credentials.

Create IAM User Group

  1. In the AWS dashboard click on Services.
  2. In the Security, Identity & Compliance section, select IAM.
  3. In the left pane, select the Groups menu item.
  4. In the upper left click the Create New Group button.
  5. Enter the name of the group.
  6. Select the Permissions if any you want to apply to the entire group.
    For instance AmazonEC2 FullAccess, We recommend you do not assign any permission, assign them on user's basis instead.
  7. Click the Next Step button.
  8. Review the group info, then click the Create Group button.

Create Access and Secret Keys

  1. In the AWS dashboard click on Services.
  2. In the Security, Identity & Compliance section, select IAM.
  3. In the left pane, select the Users menu item.
  4. In the upper left, click thje Add user button.
  5. In the User name box enter the name of your choosing.
  6. In the Access type section, check mark the Programmatic access box.
    This enable access key ID and secret access key  for the AWS API, CLI, SDK, and other development tools.
  7. Click the Next Permissions button.
  8. At this point, you can add the user to an existing group (or create a new group).
  9. Select the group for the user.
  10. Click the Next Review button.
  11. Click the Create user button.
  12. In the bottom right, click the Close button.
  13. Click on the name of the user you just created.
  14. Click the Add permissions button.
  15. Select the Attach existing policies button.
  16. Search for one or more policy types you want to attach.
  17. Check mark the box on the left of the policy names.
  18. Click the Next Review button.
  19. Click the Add permissions
  20. button.
  21. Click the Security credentials tab.
  22. Click the Create access key button.
  23. In the pop-up window, click the Donwload.csv file button. 
  24. This downloads the accessKeys.csv file which contains the access key ID and secret access key to use in the credentials file.
  25. Click the Close button.

Usage

In your client application follow these steps:

  • Instantiate the AuthenticateAwsServiceClient class.
  • Obtain the authenticated client.

The following is an example:

	// Instantiate the AuthenticateAwsServiceClient class. 
	AuthenticateAwsServiceClient authClient = 
	new AuthenticateAwsServiceClient();
			
	// Get the authenticated client. 
	ec2Client = authClient.getAuthenticatedS3Client(currentRegion);

📝 When you build your client application, assure that you add this aws-client-auth program in your client application program path.

References

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.