Using the AWS SDK for Node.js developments
- There is a sample project in the GitHub, So you can simply clone to your system. You must have Git installed to get this project from GitHub.
If you clone the project, then You can see the following line in the sample.js file.
// Load the SDK and UUID
var AWS = require(‘aws-sdk’);
var uuid = require(‘node-uuid’);
- It means, the JS files requires those dependencies for the development. So you need to run npm installcommand to install those required dependencies including AWS SDK.
- Now you want to configure your environment with AWS. To configure the AWS credentials, Create a credentials file at ~/.aws/credentialson Mac/Linux or C:\Users\USERNAME\.aws\credentials on Windows
In Linux, You want to go to your Home directory and press Ctrl+H to get the view of hidden folders. Then after creating a directory as .aws and then create a credentials file inside the folder.
Create credentials file using the following lines,
aws_access_key_id = your_access_key
aws_secret_access_key = your_secret_key
How to get AWS Access Key and Secret Key?
If you haven’t Amazon Access Key and Secret Key already, then follow these ways to get it,
- Go to your AWA Console and then Search Identity and Access Management under Services and Click to enter IAM. In the IAM Dashboard, you can see this following menus,
- Click on the first menu(Delete your root access keys) and then click Manage Security Credentials to get your keys.
- Then after you will be redirected to Security Credentials management dashboard. At there, Click access Keys(Access Key ID and Secret Access Key menu). Now you can see Create New Access Key button.
- Click Create New Access Key button to get your Access Keys. If you click Show Access key there, then you will get your Access Key and Secret Access Keys.
Run your First Application
Finally, If you check your Amazon S3 account, then you can see there was a new bucket created and the hello_world.txt file was uploaded inside that bucket.