-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b426f7c
commit 2387320
Showing
1 changed file
with
70 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,78 @@ | ||
# Agenda | ||
# | ||
# <span style="color:yellow">Agenda</span> | ||
|
||
if you want to create a static web site with s3 you have to create some resources | ||
1. bucket | ||
|
||
1. bucket | ||
2. route53 | ||
3. iam | ||
> | ||
> you have to use a domain for this configuration | ||
> I've used `babak.local`. you can use anything you want.don't worry you don't need to buy a domain name for that | ||
3. iam | ||
> you have to use a domain for this configuration | ||
> I've used `babak.local`. you can use anything you want.don't worry you don't need to buy a domain name for that | ||
after you apply terraform configuration on you aws you can copy your static website into the bucket | ||
|
||
## <span style="color:yellow">AWS CLI Command</span> | ||
|
||
`aws s3 sync staticSite s3://babak.local` | ||
|
||
--- | ||
|
||
with this command you copy all the files within the staticSite folder | ||
|
||
|
||
## <span style="color:yellow"> What is your web site url?</span> | ||
|
||
you can find it with this formula below | ||
|
||
`http://bucket-name.s3-website-Region.amazonaws.com` | ||
|
||
for example here bucket-name is `babak.local` and region is `eu-west-1` | ||
so the url is | ||
`http://babak.local.s3-website-eu-west-1.amazonaws.com` | ||
|
||
|
||
## <span style="color:yellow"> How to use this module?</span> | ||
|
||
|
||
this is very easy! just do the following steps | ||
|
||
`mkdir testFolder` | ||
|
||
`cd testFolder` | ||
|
||
`testFolder> touch main.tf` | ||
|
||
and add the following configuration to the main.tf | ||
|
||
```terraform | ||
provider "aws" { | ||
profile = "default" | ||
region = "eu-west-1" | ||
} | ||
variable "domain_name" { | ||
type = string | ||
} | ||
module "bucketWeb" { | ||
source = "https://github.com/babakDoraniArab/terraform-aws-bucket-website.git" | ||
domain_name = var.domain_name | ||
} | ||
``` | ||
|
||
### | ||
### <span style="color:yellow">final codes</span> | ||
|
||
`terraform init` | ||
|
||
`terraform fmt` | ||
|
||
`terraform validate` | ||
|
||
`terraform apply` | ||
|
||
after you apply terraform configuration on you aws you can copy your static website into the bucket | ||
## AWS CLI Command | ||
`aws s3 sync staticSite s3://babak.local` | ||
--- | ||
with this command you copy all the files within the staticSite folder | ||
|
||
## What is your web site url ? | ||
you can find it with this formula below | ||
|
||
`http://bucket-name.s3-website-Region.amazonaws.com` | ||
<h1 style="color:yellow">congratulation you maid it!</h1> | ||
|
||
for example here bucket-name is `babak.local` and region is `eu-west-1` | ||
so the url is | ||
`http://babak.local.s3-website-eu-west-1.amazonaws.com` |