Frontend service that renders an HTML page to vote on cats vs. dogs.
The "vote" service forwards requests to the "api" microservice to store and retrieve results on whether a voter prefers cats or dogs.
The two services communicate through Service Discovery which AWS Copilot sets up by default by querying the api.voting-app.local:8080
endpoint.
Alternatively, you can use the COPILOT_SERVICE_DISCOVERY_ENDPOINT
environment variable
that Copilot injects by default to your service.
- Install the AWS Copilot CLI https://aws.github.io/copilot-cli/
- Run
$ copilot init
- Enter "voting-app" for the name of your application.
- Select "Load Balanced Web Service" for the service type.
- Enter "vote" for the name of the service.
- Say "Y" to deploying to a "test" environment ๐
Once deployed, your service will be accessible at an HTTP endpoint provided by the CLI like: http://votin-publi-anelun2kxbrl-XXXXXXX.YYYYY.elb.amazonaws.com/
AWS Copilot uses AWS CloudFormation under the hood to provision your infrastructure resources.
You should be able to see a voting-app-test-vote
stack that yours ECS service along with all the peripheral resources
needed for logging, service discovery, and more...
Copilot stores the infrastructure-as-code for your service under the copilot/
directory.
copilot
โโโ vote
โโโ manifest.yml
The manifest.yml
file under vote/
holds the common configuration for a "load balanced web service" pattern.
For example, you can setup configuration for your ECS task size, exposed port, environment variables,
secrets from AWS Secrets Manager or AWS Systems Manager Parameter Store.
If you'd like to delete only the service from the "voting-app" application.
$ copilot svc delete
If you'd like to delete the entire application including other services and deployment environments:
$ copilot app delete