Git Product home page Git Product logo

aws-copilot-sample-service's Introduction

AWS Copilot CLI Sample App

This is a sample AWS Copilot sample app. You can use AWS Copilot to deploy this simple website to Amazon ECS.

Deploying

To deploy this app, clone this repo and then run:

copilot init --app demo \
  --name api \
  --type "Load Balanced Web Service" \
  --dockerfile "./Dockerfile" \
  --deploy

Copilot will set up the following resources in your account:

  • A VPC
  • Subnets/Security Groups
  • Application Load Balancer
  • Amazon ECR Repositories
  • ECS Cluster & Service running on AWS Fargate

Cleaning up

Since this demo sets up resources in your account, let's delete them so you don't get charged:

copilot app delete

Learning More

If you want to learn more about AWS Copilot, check out our documentation.

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

aws-copilot-sample-service's People

Contributors

amazon-auto avatar iamhopaul123 avatar kohidave avatar neilkuan avatar paragbhingre avatar yenyuns avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

aws-copilot-sample-service's Issues

Deploy your first application returns 404

Hello,
I've been following the steps in the documentation for deploying my first application and it successfully deployed on AWS. I then clicked the URL shown in the console and got to a 404 page. After looking at the logs (copilot svc logs)

copilot/example-app/408f9 2022/08/26 09:34:39 [error] 31#31: *116 "/usr/share/nginx/html/example-app/index.html" is not found (2: No such file or directory), client: 10.0.1.199, server: localhost, request: "GET /example-app/ HTTP/1.1", host: "examp-publi-18dec46ypctqj-243473654.eu-west-1.elb.amazonaws.com"

and the Dockerfile in this repo,

COPY index.html /usr/share/nginx/html

I noticed that the index.html file is being copied to the root of the nginx html directory. This works fine when I run the image locally, but once it's in ECS, the URL has the application name append, which leads to nginx looking for a file under /usr/share/nginx/html/<application name>/index.html, which does not exist.

I believe this is an error in the documentation or repository and should be fixed, as it was very confusing to me.

docker hub download rate limit

docker hub download rate limit

Hi !!!
I follow the aws-copilot-sample-service readme.md and use this repo to do exercises.
But i ran into this problem.

You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limits

I think maybe can change nginx to public.ecr.aws/nginx/nginx:1.19-alpine hosted by https://gallery.ecr.aws/nginx/nginx.

404 url-path-related problem still exists

Hi!

I got a 404 error after deploying and following the URL, just as in issue #7 (but a year later) using the latest version of this repo.

On CloudWatch, I see "/usr/share/nginx/html/copilot-example-frontend/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /copilot-example-frontend/ HTTP/1.1", host: "copilo-publi-xxxxxxxxxxxx.us-east-1.elb.amazonaws.com"

Always run into 'NotStabilized'

I now try the second consecutive day with

$ copilot version
version: v1.33.1, built for linux

But it always end with 'Your service failed to create.' like this:

$ copilot init
[...]
- Creating the infrastructure for the cp-ws-prod-gb environment.                       [update complete]  [71.6s]
  - An ECS cluster to group your services                                              [create complete]  [3.3s]
  - A security group to allow your containers to talk to each other                    [create complete]  [0.0s]
  - An Internet Gateway to connect to the public internet                              [create complete]  [16.7s]
  - A resource policy to allow AWS services to create log streams for your workloads.  [create complete]  [3.3s]
  - Private subnet 1 for resources with no internet access                             [create complete]  [2.6s]
  - Private subnet 2 for resources with no internet access                             [create complete]  [4.6s]
  - A custom route table that directs network traffic for the public subnets           [create complete]  [10.3s]
  - Public subnet 1 for resources that can access the internet                         [create complete]  [2.6s]
  - Public subnet 2 for resources that can access the internet                         [create complete]  [2.6s]
  - A private DNS namespace for discovering services within the environment            [create complete]  [45.1s]
  - A Virtual Private Cloud to control networking of your AWS resources                [create complete]  [12.1s]
✔ Successfully deployed environment prod-gbLogin Succeeded!
STEP 1/4: FROM public.ecr.aws/nginx/nginx:1.19
STEP 2/4: EXPOSE 80
--> Using cache 867e3c77224416e953a725f752ece80440deb859ec6db4e84a371d5e2bc47934
--> 867e3c772244
STEP 3/4: COPY index.html /usr/share/nginx/html
--> Using cache bd0071208620f8ed65a1d38f6e07a78d615c92eb545dfc22412811fd9cef5459
--> bd0071208620
STEP 4/4: LABEL "com.aws.copilot.image.builder"="copilot-cli" "com.aws.copilot.image.container.name"="nginx" "com.aws.copilot.image.version"="v1.33.1"
--> Using cache 28a5d95c5f990619c52d69803cd15c070e91fa337398873b752632d1a767c8e5
COMMIT 508649137979.dkr.ecr.eu-west-2.amazonaws.com/cp-ws/nginx:latest
--> 28a5d95c5f99
Successfully tagged 508649137979.dkr.ecr.eu-west-2.amazonaws.com/cp-ws/nginx:latest
Successfully tagged 508649137979.dkr.ecr.eu-central-1.amazonaws.com/cp-ws/nginx:latest
28a5d95c5f990619c52d69803cd15c070e91fa337398873b752632d1a767c8e5
Getting image source signatures
Copying blob 431f409d4c5a done   | 
Copying blob c9732df61184 done   | 
Copying blob 4b8db2d7f35a done   | 
Copying blob 02c055ef67f5 done   | 
Copying blob f0f30197ccf9 done   | 
Copying blob eeb14ff930d4 done   | 
Copying blob 1d1e08aebc02 done   | 
Copying config 28a5d95c5f done   | 
Writing manifest to image destination
✔ Proposing infrastructure changes for stack cp-ws-prod-gb-nginx
- Creating the infrastructure for stack cp-ws-prod-gb-nginx                          [rollback complete]  [219.6s]
  The following resource(s) failed to create: [Service]. Rollback reques                                  
  ted by user.                                                                                            
  - An IAM Role for App Runner to use on your behalf to pull your image from ECR     [delete complete]    [13.3s]
  - An IAM role to control permissions for the containers in your service            [delete complete]    [13.3s]
  - An App Runner service to run and manage your containers                          [delete complete]    [9.4s]
    Resource handler returned message: "Your service failed to create. Rev                                
    iew the application logs to find the source of error and retry." (Requ                                
    estToken: b442c069-80c2-649a-0c64-df6f0b542a3f, HandlerErrorCode: NotS                                
    tabilized)                                                                                            
You may fix the error by updating the service code or the manifest configuration.
You can then retry deploying your service by running `copilot svc deploy`.
✘ deploy service nginx to environment prod-gb: deploy service: stack cp-ws-prod-gb-nginx did not complete successfully and exited with status ROLLBACK_COMPLETE

copilot init unknown flag: --svc

The Deploying command on the RREAD.me file can not work.

copilot init --app demo                  \
  --svc api                              \
  --svc-type 'Load Balanced Web Service' \
  --dockerfile './Dockerfile'            \ 
  --deploy

unknown flag: --svc

Checking the copilot-cli Release, I notice there are some breaking changes like:

  • Breaking change: The --svc flag is renamed to --name and --svc-type to --type for the copilot init command to accommodate for new workload types.

Therefore, I have opened a PR to fix the command.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.