Generating AWS access keys

Before implementing the upload feature, we must create an AWS API key to authorize our back end at AWS, in order to upload new files to the S3 bucket.

Click on your username in the top bar of AWS. There, you find a tab called My Security Credentials, which navigates to a screen offering various options to secure access to your AWS account.

You will probably be confronted with a dialog box like the following:

You can click on Continue to Security Credentials to continue. It is generally recommended to use AWS Identity and Access Management (IAM). It allows you to efficiently manage secure access to AWS resources with separate IAM users. Throughout this book, we are going to use the root user in the same way that we are now, but I recommend looking at AWS IAM when writing your next application.

You should now see the credentials page, with a big list of different methods for storing credentials. This should look like the following screenshot:

In the list, expand the tab titled Access keys shown in the preceding screenshot. In this tab, you will find all access tokens for your AWS account.

To generate a new access token, click on Create New Access Key. The output should look as follows:

The best practice is to download the key file as prompted, and save it somewhere securely, just in case you lose the key at any time. You cannot retrieve access keys again after closing the window; so, if you lose them, you will have to delete the old key and generate a new one.

This approach is acceptable for explaining the basics of AWS. With such a huge platform, there are further steps that you have to take to secure your application even more. For example, it is recommended to renew API keys every 90 days. You can read more about all of the best practices at https://docs.aws.amazon.com/de_de/general/latest/gr/aws-access-keys-best-practices.html.

As you can see in the preceding screenshot, AWS gives us two tokens. Both are required to gain access to our S3 bucket.

Now, we can start to program the uploading mechanism.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.233.41