Static Web Hosting with Continuous Deployment

0

Hello,

I am working on Build a serverless web application using Amplify, Cognito, API Gateway, Lambda & DynamoDB use case https://aws.amazon.com/getting-started/hands-on/build-serverless-web-app-lambda-apigateway-s3-dynamodb-cognito/module-1/ My question is have created a Repository name "wildrydes-site". Now i am trying to perform Populate git repository i have created the bucket and object . As per the use case which html file i have upload to get the same website which is shown in the use case. Can somebody help me from where i get same website file to upload also after uploading the file do i have to run these commands: a. Change directory into your repository and copy the static files from S3: cd wildrydes-site aws s3 cp s3://wildrydes-us-east-1/WebApplication/1_StaticWebHosting/website ./ --recursive

b. Commit the files to your Git service $ git add . $ git commit -m 'new' $ git push Please suggest. Thanks,

1 Answer
0
Accepted Answer

Hi Monica,

after reading the steps make sure you do the following:

  • Create a repo (which you did) and from your local prompt, run git clone https: //git-codecommit.<REGION>.amazonaws.com/v1/repos/wildrydes-site. Make sure you specify the correct region if you created a CodeCommit repo. The result of that command will be an empty repository.
  • Do cd wildrydes-site from your local prompt.
  • From within your local folder, execute this command aws s3 cp s3://wildrydes-<REGION>/WebApplication/1_StaticWebHosting/website ./ --recursive. This command is saying "copy recursively all files and folders contained in the public S3 bucket named wildrydes-<REGION> into my local folder". Choose you region, run it and the result will be that now you should have those files locally to your wildrydes-site folder (but not committed yet).
  • To commit and push those files remotely, from local prompt, run git add . , git commit -m 'new' and git push. This will push the result to your remote repository (CodeCommit or Github).

Hope it helps, and if it does, I 'd appreciate if answer can be accepted ;)

profile picture
EXPERT
answered a year ago
  • @alatech: Thanks for response. I did till cd wildrydes-site but when i give aws s3 cp s3://wildrydes-<REGION>/WebApplication/1_StaticWebHosting/website ./ --recursive. Its giving me error: monic@DESKTOP-8FGFDOS MINGW64 ~/wildrydes-site (master) $ aws s3 cp s3://wildrydes-us-west-2/WebApplication/1_StaticWebHosting/website Note: AWS CLI version 2, the latest major version of the AWS CLI, is now stable and recommended for general use. For more information, see the AWS CLI version 2 installation instructions at: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html

    usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters] To see help text, you can run:

    aws help aws <command> help aws <command> <subcommand> help aws: error: the following arguments are required: paths

    Also,what content should i keep in index.html file that i have to upload in S3?

  • Hi would first suggest to update your AWS CLI. You can follow this guide: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html#cli-configure-quickstart-config and/or https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html. Assuming you have correctly installed CLI, make sure you copy the whole command: aws s3 cp s3://wildrydes-us-west-2/WebApplication/1_StaticWebHosting/website ./ --recursive , as it seems your command stops at "/website" wording. Let me know.

  • @alatech : git add . , git commit -m 'new' and git push worked... Now what content i can put in index.html file?

  • Well, assuming you ran “ aws s3 cp s3://wildrydes-us-west-2/WebApplication/1_StaticWebHosting/website ./ --recursive” and then the 3 commands you said above, then you code commit or GitHub repository should have a bunch of html/JS/css files. Can you verify that they have been pushed to the repository remotely (either going to GitHub page or code commit in the console)?

  • It worked. Thanks.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions