Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1ebb55c

Browse files
committed
format readme.md
1 parentcbffcb2 commit1ebb55c

File tree

1 file changed

+65
-65
lines changed

1 file changed

+65
-65
lines changed

‎cloud-static-content-hosting/README.md

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -55,97 +55,97 @@ the content globally.
5555

5656
4. Create IAM user that has only the necessary rights for this application.
5757

58-
* Click`Users`
59-
* Click`Add user`. Choose`User name` as you wish and`Access type` should be`Programmatic access`. Click`Next: Permissions`.
60-
* Choose`Attach existing policies directly`. Select`AmazonS3FullAccess` and`CloudFrontFullAccess`. Click`Next: Tags`.
61-
* No tags are necessarily needed, so just click`Next: Review`.
62-
* Review the presented information and if all seems good click`Create user`.
63-
* You are presented with`Access key ID` and`Secret access key` which you will need to complete this example, so store them safely.
64-
* Click`Close`.
58+
* Click`Users`
59+
* Click`Add user`. Choose`User name` as you wish and`Access type` should be`Programmatic access`. Click`Next: Permissions`.
60+
* Choose`Attach existing policies directly`. Select`AmazonS3FullAccess` and`CloudFrontFullAccess`. Click`Next: Tags`.
61+
* No tags are necessarily needed, so just click`Next: Review`.
62+
* Review the presented information and if all seems good click`Create user`.
63+
* You are presented with`Access key ID` and`Secret access key` which you will need to complete this example, so store them safely.
64+
* Click`Close`.
6565

6666
5.[Install AWS Command Line Interface (AWS CLI)](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv1.html) to gain programmic access to AWS cloud.
6767

6868
6. Configure AWS CLI with command`aws configure` as desribed in the[instructions](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html#cli-configure-quickstart-config)
6969

7070
7. Create AWS S3 bucket for the web site content. Note that the S3 bucket names must be globally unique.
7171

72-
* The syntax is`aws s3 mb <bucket name>` as described in the[instructions](https://docs.aws.amazon.com/cli/latest/userguide/cli-services-s3-commands.html#using-s3-commands-managing-buckets-creating)
73-
* For example`aws s3 mb s3://my-static-website-jh34jsjmg`
74-
* Verify that the bucket was successfully created with command`aws s3 ls` which list the existing buckets
72+
* The syntax is`aws s3 mb <bucket name>` as described in the[instructions](https://docs.aws.amazon.com/cli/latest/userguide/cli-services-s3-commands.html#using-s3-commands-managing-buckets-creating)
73+
* For example`aws s3 mb s3://my-static-website-jh34jsjmg`
74+
* Verify that the bucket was successfully created with command`aws s3 ls` which list the existing buckets
7575

7676
8. Configure the bucket as a web site with command`aws s3 website` as described in the[instructions](https://docs.aws.amazon.com/cli/latest/reference/s3/website.html).
7777

78-
* E.g.`aws s3 website s3://my-static-website-jh34jsjmg --index-document index.html --error-document error.html`
78+
* E.g.`aws s3 website s3://my-static-website-jh34jsjmg --index-document index.html --error-document error.html`
7979

8080
9. Upload content to the bucket.
8181

82-
* First create the content, at least`index.html` and`error.html` documents.
82+
* First create the content, at least`index.html` and`error.html` documents.
8383

84-
index.html
85-
```html
86-
<!doctype html>
87-
<head>
88-
<title>My Static Web Site</title>
89-
</head>
90-
<body>
91-
<h1>I'm the index.html</h1>
92-
</body>
93-
```
94-
95-
error.html
96-
```html
97-
<!doctype html>
98-
<head>
99-
<title>My Static Web Site</title>
100-
</head>
101-
<body>
102-
<h1>I'm the index.html</h1>
103-
</body>
104-
```
105-
106-
* Upload the content to your bucket as described[here](https://docs.aws.amazon.com/cli/latest/userguide/cli-services-s3-commands.html#using-s3-commands-managing-objects-copy)
107-
* E.g.`aws s3 cp index.html s3://my-static-website-jh34jsjmg` and`aws s3 cp error.html s3://my-static-website-jh34jsjmg`
84+
index.html
85+
```html
86+
<!doctype html>
87+
<head>
88+
<title>My Static Web Site</title>
89+
</head>
90+
<body>
91+
<h1>I'm the index.html</h1>
92+
</body>
93+
```
94+
95+
error.html
96+
```html
97+
<!doctype html>
98+
<head>
99+
<title>My Static Web Site</title>
100+
</head>
101+
<body>
102+
<h1>I'm the index.html</h1>
103+
</body>
104+
```
105+
106+
* Upload the content to your bucket as described [here](https://docs.aws.amazon.com/cli/latest/userguide/cli-services-s3-commands.html#using-s3-commands-managing-objects-copy)
107+
* E.g. `aws s3 cp index.html s3://my-static-website-jh34jsjmg` and `aws s3 cp error.html s3://my-static-website-jh34jsjmg`
108108

109109
10. Next we need to set the bucket policy to allow read access.
110110

111-
* Create`policy.json` with the following contents (note that you need to replace the bucket name with your own).
112-
113-
```json
114-
{
115-
"Version":"2012-10-17",
116-
"Statement": [
117-
{
118-
"Sid":"PublicReadGetObject",
119-
"Effect":"Allow",
120-
"Principal":"*",
121-
"Action":"s3:GetObject",
122-
"Resource":"arn:aws:s3:::my-static-website-jh34jsjmg/*"
123-
}
124-
]
125-
}
126-
```
127-
128-
* Set the bucket policy according to these[instructions](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-policy.html)
129-
* E.g.`aws s3api put-bucket-policy --bucket my-static-website-jh34jsjmg --policy file://policy.json`
111+
* Create `policy.json` with the following contents (note that you need to replace the bucket name with your own).
112+
113+
```json
114+
{
115+
"Version": "2012-10-17",
116+
"Statement": [
117+
{
118+
"Sid": "PublicReadGetObject",
119+
"Effect": "Allow",
120+
"Principal": "*",
121+
"Action": "s3:GetObject",
122+
"Resource": "arn:aws:s3:::my-static-website-jh34jsjmg/*"
123+
}
124+
]
125+
}
126+
```
127+
128+
* Set the bucket policy according to these [instructions](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-policy.html)
129+
* E.g. `aws s3api put-bucket-policy --bucket my-static-website-jh34jsjmg --policy file://policy.json`
130130

131131
11. Test the web site in your browser.
132132

133-
* The web site URL format is`http://<bucket-name>.s3-website-<region-name>.amazonaws.com`
134-
* E.g. this web site was created in`eu-west-1` region with name`my-static-website-jh34jsjmg` so it can be accessed via url`http://my-static-website-jh34jsjmg.s3-website-eu-west-1.amazonaws.com`
133+
* The web site URL format is `http://<bucket-name>.s3-website-<region-name>.amazonaws.com`
134+
* E.g. this web site was created in `eu-west-1` region with name `my-static-website-jh34jsjmg` so it can be accessed via url `http://my-static-website-jh34jsjmg.s3-website-eu-west-1.amazonaws.com`
135135

136136
12. Create CloudFormation distribution for the web site.
137137

138-
* The syntax is described in[this reference](https://docs.aws.amazon.com/cli/latest/reference/cloudfront/create-distribution.html)
139-
* E.g. the easiest way is to call`aws cloudfront create-distribution --origin-domain-name my-static-website-jh34jsjmg.s3.amazonaws.com --default-root-object index.html`
140-
* There's also JSON syntax e.g.`--distribution-config file://dist-config.json` to pass distribution configuration arguments in file
141-
* The output of the call will show you the exact distribution settings including the generated CloudFront domain name you can use for testing e.g.`d2k3xwnaqa8nqx.cloudfront.net`
142-
* CloudFormation distribution deployment takes some time, but once it's completed your web site is served from data centers all around the globe!
138+
* The syntax is described in [this reference](https://docs.aws.amazon.com/cli/latest/reference/cloudfront/create-distribution.html)
139+
* E.g. the easiest way is to call `aws cloudfront create-distribution --origin-domain-name my-static-website-jh34jsjmg.s3.amazonaws.com --default-root-object index.html`
140+
* There's also JSON syntax e.g. `--distribution-config file://dist-config.json` to pass distribution configuration arguments in file
141+
* The output of the call will show you the exact distribution settings including the generated CloudFront domain name you can use for testing e.g. `d2k3xwnaqa8nqx.cloudfront.net`
142+
* CloudFormation distribution deployment takes some time, but once it's completed your web site is served from data centers all around the globe!
143143

144144
13. That's it! You have implemented a static web site with content distribution network serving it lightning fast all around the world.
145145

146-
* To update the web site you need to update the objects in S3 bucket and invalidate the objects in the CloudFront distribution
147-
* To do it from AWS CLI see[this reference](https://docs.aws.amazon.com/cli/latest/reference/cloudfront/create-invalidation.html)
148-
* Some further development you might want to do is serve the content over https and add a domain name for your site
146+
* To update the web site you need to update the objects in S3 bucket and invalidate the objects in the CloudFront distribution
147+
* To do it from AWS CLI see [this reference](https://docs.aws.amazon.com/cli/latest/reference/cloudfront/create-invalidation.html)
148+
* Some further development you might want to do is serve the content over https and add a domain name for your site
149149

150150
## Applicability
151151

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp