# AWS Copilot

## Basics

* CLI tool used to build, release and operate production-ready containerized apps.
* This tool makes it seamless to run apps in Apprunner, ECS and Fargate.
* This tool used cloud formation to create the infrastructure.
* Can be integrated with Code pipeline, so that automated deployments can be done.

## Commands

1.  Initialize copilot

    ```sh
        copilot init
    ```
2.  Create an environment using copilot, which will create a manifest file.

    ```sh
        copilot env init --name <env_name> --profile <profile_name> --app <app_name>

        ## profile_name can be set to default
    ```

    > Note : Before running the above command make sure that aws configuration file is already created, can be done so by below command.

    ```sh
        touch /home/ec2-user/.aws/config
    ```
3.  Deploy the environment using the manifest file, created based on environment.

    ```sh
        copilot env deploy --name prod
    ```

    > Note : For above command to successfully execute make sure the user executing this have the right roles and access.
4.  To deploy the application

    ```sh
        copilot deploy
    ```
5.  To delete the infrastructure

    ```sh
        copilot app delete
    ```

## Reference

* [Getting Started](https://aws.amazon.com/containers/copilot/)
* [Copilot CLI](https://aws.github.io/copilot-cli/)
