Trying to deploy stuff on AWS
Tags: aws, javascript, react
Published: 2019-10-08 10:58:28

All that I did last time was write up tests and fix CI.. But now what next? How do I CD the damn thing. I literally have no idea, so hopefully by the end of this blog I do.
Things that I know at the moment...
* I need a domain name
* I need to deploy a react app on AWS

AWS, sponsor me if we are successful please. Well, no one would listen anyway. Onto the research and stuff...


Signing up for AWS??

Ummmmm obviously...

* waiting for verification code
* IAM? and all that?

![hours later gif](https://media.giphy.com/media/3o6wNYW4Hqk6C1Uu1W/giphy.gif)

Now what..

That was a really long break. I have so much food in me, I cant type. 

Okay so went ahead with AWS Amplify. Looked simple enough and my previous CI stuff makes a bit more sense when I read this. Hoping it would not cause an issue.

AAHHH SHIT

Okay let me investigate!

![investigate](https://media.giphy.com/media/Sq8KpWNNNBk2I/giphy.gif)

Okay so maybe I did not build the app. I guess, I have to configure that in parcel. Well, let's see how to do that.

```
"scripts": {
    "test": "jest --config=jest.config.json",
    "start": "parcel index.html",
    "build": "parcel build index.html"
  }
```

This may not be easy... Because I see that there are a lot of building patterns in the parcel CLI section.

Merged the branch which has all the new styles into the master..
I fear that I am not utilizing the build power of parcel.

I feel like I should try and see if I can write my own build file in my codebase.

Let's try the `npm install -g @aws-amplify/cli` way.

Well I get `command not found: amplify`. Stuck!

The yarn stuff

Maybe I should run yarn again after removing the `node_modules`.

Same failure..

HMMMMMMMMMM

So I added a pre-build section to the build config.
It seems that after the build the config file cant find the base folder.

WHAT THE HECK!!!


So it seems like the build.yml file for Amplify works differently to other platforms.
Usually what happens is.

Deployment failing.. WHAT IS GOING ON!!! WHY ARE THINGS NOT SIMPLE!
They could have provided a better log record. Gaah!

I bought a domain now, so, we should see a basic website by the end of this.. if we get there though.

So it's one day later..
I am still trying to think about it. I think I shall try the good old s3 bucket stuff that I see that my company does.

![googling gif](https://media.giphy.com/media/1BgNAAaeCr4gcZlMy6/giphy.gif)

https://youtu.be/RQdxHi4_Pvc (stumbling onto cool youtube video, spending 3-4 hours on youtube
)

https://open.spotify.com/album/3a3AA8QEvjP7onsoz3jaqc?si=VZYHjHJVTFmqrIr-rzSo3A

Created a S3 bucket --> Setup Permission policy --> A lot of aws stuff and phew


Got it running! But now I want to have my domain name which I bought, route here. Hmmmm Looks like there is not a simple setting to setup the thing which I want to do(I dont know the jargon used for what I am trying to do, I'm dumb okay?!).

Research tell me that I have to create a cloudfront distribution. Let's do it.

Waiting... waiting... waiting ... AHA Deployed!!

Now I have to create something in Route53 from aws, which shall enable me to link my domain name and the hosted content in cloudfront.


My source tells me that it would need 48 hours to have the website deployed.

So if everything works out, Ya'll should be able to see something on https://mentorfix.org/ . Obviously nothing works at the moment, but I wish to work on in more eventually.

Let me know in the comments if you find something that I should have done to lessen my time spent on deployments and I will try and do that. Or maybe, you can make that contribution to the org if you wish to. 


Thank you so much for bearing with me, I know this blogpost is not as conclusive as the last one. But I will improve eventually.


Until then..

![kachow](https://media.giphy.com/media/l44Qdv43pGxw9giuA/giphy.gif)

PS: Fave is hiring, checkout [our career page](careers.myfave.com)!


PPS: This [link](https://benjamincongdon.me/blog/2017/06/13/How-to-Deploy-a-Secure-Static-Site-to-AWS-with-S3-and-CloudFront/#step-4-configure-route53-to-route-traffic-from-our-custom-domain) was a massive help, do check it out.