Glad you're interested in checking AWSome out. To start making the most of AWSome you will need to have your AWS credentials ready so if you don't have those setup, let's do that before moving on.
If you do have your credentials, that's great. Feel free to just skip ahead then
Otherwise, please read on to setup your AWS account.
- STEP 1: Get an AWS Account
- STEP 2: Login to your AWS Console
- STEP 3: Create a new AWS user
- STEP 4: Create a group policy
- STEP 5: Install the awsome dependency
Let's get your AWS account up and running. If you don't have an AWS account, not to worry, this guide will help you set one up, just continue reading.
If you do have an account, that's great. Just skip ahead then
So you don't have an AWS Account yet. Not to worry, it takes 5 minutes or less to get one.
Just go ahead and create your free AWS account now and let's continue once you've completed the sign up process.
AWS has a nice online console that you can access whenever you want to manage your AWS resources.
So let's go now and login to your AWS console so we can create a new user. Just login with your email and password that you used to create your account.
We don't always want to access your AWS account with your email and password, because that's not secure, so instead, AWS allows you to create special users that are more secure to use.
We want to create such a user now, so let's go ahead and start the New User Wizard and complete it step by step.
First, give your user a name (call your user awsome).
Next, check both check boxes to specify that you want Programmatic access and AWS Management Console access as well. And let the Autogenerated password and the Require password reset boxes selected.
Click the Next: Permissions button to go and set some permissions for the new user.
Click the Create group button to create a brand new group for your new user.
Type awsome as the name of the group (yeah let's keep it identical to the user name we created in Step 3.1)
Click the Create group button to finish the process, and don't worry about the policy stuff, just ignore that.
Almost there. Good job, you just created a brand new group. We are ready to move on and finish creating the user as well.
Click the Next: Review button to review our new user.
Looks good! Let's just go ahead and confirm that we want to finish the process now. Just click the Create user button to finish.
Amazing! You've got yourself a brand new user. Congrats! You will notice the Access key ID and the Secret access key that come with your user. Those are very important and we need those to access your account. The Secret access key is especially sensitive that's why AWS hides that.
Now, just click the Show link next to the Secret access key and do the same for the Password and copy the values and store them somewhere safe.
Use a Password Manager like 1Password or do whatever you do with all your sensitive information like passwords or credit card numbers. But whatever you do, make sure these are safe and treat them as you would any sensitive information - with utmost care for their security.
Congratulations, you now have your AWS user credentials handy and ready to be used with AWSome.
Policies are used in AWS to give users specific permissions to AWS resources. You can give a user permission to everything but in general that's a security concern.
So what we want to do is to give our awsome user we created, the permissions it needs and not a permission more.
We want to start out by going to the awsome group actually, and not the user, so that we can control the permissions at the group level.
Click on the Inline Policies section to expand it and the lick the click here link to create a policy.
Next, select the Custom Policy section and press the Select button.
Just give your policy a name - awsome will work - and enter the following text for the policy:
Expand to see the policy text
``` { { "Version": "2012-10-17", "Statement": [ { "Sid": "awsomepolicy1", "Action": [ "s3:headBucket", "s3:createBucket", "s3:listObjectsV2", "s3:deleteBucket", "s3:getBucketWebsite", "s3:putBucketWebsite", "s3:putBucketPolicy", "s3:deleteBucketWebsite", "s3:putObject", "s3:deleteObject", "route53:listHostedZones", "route53:createHostedZone", "route53:deleteHostedZone", "route53:listResourceRecordSets", "route53:changeResourceRecordSets" ], "Effect": "Allow", "Resource": "*" } ] } ```Click the Apply Policy button to apply our new policy to the group.
You did it! You have not only created a new user with its own group but you've attached a policy to your group.
This is great. Your AWS account is now ready to go.
Great, you should have your AWS user credentials now (key and secret) so you can just install AWSome and start using it.
To install, just add awsome
to your NPM module like so:
npm i -S awsome
Then you can import awsome
in your code as follows:
const awsome = require('awsome')
AWSome expects your AWS user credentials to be available as environment variables, as documented in the official AWS SDK Node.js documentation.
The two environment variables we want are AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
. These are the values you created in Step 3.10 and that you stored somewhere safe.
It does not matter how the variables end up in the environment, as long as the Node.js process can find them in the process.env
object. You can set them at the command prompt or you can load them from a secure location at runtime and inject them in the process.env
.
Whatever you do, make sure your credentials are safe and secure and are not exposed in your code
If you do want to inject them at run time, here's how you can do that:
process.env.AWS_ACCESS_KEY_ID = <inject value>
process.env.AWS_SECRET_ACCESS_KEY = <inject value>
Good stuff! That's all there is to it. You are now ready to start using AWSome.
Please have a look at the examples to see what you can do with AWSome.
Have a look at the list of examples available:
Creating a bucket
Retrieving a bucket
Updating a bucket
Deleting a bucket
Hosting a domain
Unhosting domain
Linking bucket to a domain
Unliking a bucket from a domain
Have fun!