Skip to content

Commit

Permalink
Merge pull request aws-samples#11 from jschwarzwalder/patch-1
Browse files Browse the repository at this point in the history
Making directions clearer and more direct.
  • Loading branch information
abaird986 authored Jul 24, 2018
2 parents a25c52e + 2fb156b commit 3c9d568
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions module-2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ You can check on the status of your stack creation either via the AWS Console or
```
aws cloudformation describe-stacks --stack-name MythicalMysfitsCoreStack
```
When in the `describe-stacks` response, you see a status of `CREATE_COMPLETE`, CloudFormation has finished provisioning all of the core networking and security resources described above.

Once you see `CREATE_COMPLETE` in the `describe-stacks` response command above, copy the full response and save it for future reference in a text editor. Or, create a temporary folder and file to save it to within your IDE. This JSON response contains the unique identifiers for several of the created resources, which we will use later in this workshop.
Run the the `describe-stacks` command, until you see a status of ```"StackStatus": "CREATE_COMPLETE"```

When you get this response, CloudFormation has finished provisioning all of the core networking and security resources described above.

Copy the **full response** and save it for future reference in a text editor. Or, create a temporary folder and file to save it to within your IDE. This JSON response contains the unique identifiers for several of the created resources, which we will use later in this workshop.

## Module 2a: Deploying a Service with AWS Fargate

Expand Down Expand Up @@ -167,7 +170,19 @@ aws logs create-log-group --log-group-name mythicalmysfits-logs

Now that we have a cluster created and a log group defined for where our container logs will be pushed to, we're ready to register an ECS **task definition**. A task in ECS is a set of container images that should be scheduled together. A task definition declares that set of containers and the resources and configuration those containers require. You will use the AWS CLI to create a new task definition for how your new container image should be scheduled to the ECS cluster we just created.

A JSON file has been provided that will serve as the input to the CLI command, stored at `~/environment/aws-modern-application-workshop/module-2/aws-cli/task-definition.json`. Open this file in the IDE and replace the indicated values with the appropriate ones from your created resources. These values with be pulled from the CloudFormation response you copied earlier as well as the docker image tag that you pushed earlier to ECR, eg: `111111111111.dkr.ecr.us-east-1.amazonaws.com/mythicalmysfits/service:latest`
A JSON file has been provided that will serve as the input to the CLI command.

Open `~/environment/aws-modern-application-workshop/module-2/aws-cli/task-definition.json` in the IDE.

Replace the indicated values with the appropriate ones from your created resources.

These values with be pulled from the CloudFormation response you copied earlier as well as the docker image tag that you pushed earlier to ECR, eg: `111111111111.dkr.ecr.us-east-1.amazonaws.com/mythicalmysfits/service:latest`

If you need to retrieve the values from the CloudFormation respose, run this command:

```
aws cloudformation describe-stacks --stack-name MythicalMysfitsCoreStack
```

Once you have replaced the values in `task-defintion.json` and saved it. Execute the following command to register a new task definition in ECS:

Expand All @@ -186,8 +201,7 @@ To provision a new NLB, execute the following CLI command in the Cloud9 terminal
```
aws elbv2 create-load-balancer --name mysfits-nlb --scheme internet-facing --type network --subnets REPLACE_ME_PUBLIC_SUBNET_ONE REPLACE_ME_PUBLIC_SUBNET_TWO
```

Copy the response provided by this command, which contains the DNS name of the provisioned NLB as well as its ARN. You will use this DNS name to test the service once it has been deployed. And the ARN will be used in a future step.
Copy the values at ```"DNSName":```, ```"VpcId":```, & ```"LoadBalancerArn":``` or save the **full response** provided by this command, which contains the DNS name of the provisioned NLB as well as its ARN. You will use this DNS name to test the service once it has been deployed. And the ARN will be used in a future step.

#### Create a Load Balancer Target Group

Expand All @@ -196,8 +210,7 @@ Next, use the CLI to create an NLB **target group**. A target group allows AWS r
```
aws elbv2 create-target-group --name MythicalMysfits-TargetGroup --port 8080 --protocol TCP --target-type ip --vpc-id REPLACE_ME --health-check-interval-seconds 10 --health-check-path / --health-check-protocol HTTP --healthy-threshold-count 3 --unhealthy-threshold-count 3
```

Copy and save the response from the above command as well, which contains the Target Group ARN to be used in the next step.
Copy the value at ```"TargetGroupArn":``` or save the **full response** from the above command as well, which contains the Target Group ARN to be used in the next step.

#### Create a Load Balancer Listener

Expand Down Expand Up @@ -225,7 +238,7 @@ If the above returns an error about the role existing already, you can ignore it

With the NLB created and configured, and the ECS service granted appropriate permissions, we're ready to create the actual ECS **service** where our containers will run and register themselves to the load balancer to receive traffic. We have included a JSON file for the CLI input that is located at: `~/environment/aws-modern-application-workshop/module-2/aws-cli/service-definition.json`. This file includes all of the configuration details for the service to be created, including indicating that this service should be launched with **AWS Fargate** - which means that you do not have to provision any servers within the targeted cluster. The containers that are scheduled as part of the task used in this service will run on top of a cluster that is fully managed by AWS.

Open this file and replace the indicated values of `REPLACE_ME` and save it, then run the following command to create the service:
Open ```~/environment/aws-modern-application-workshop/module-2/aws-cli/service-definition.json``` in the IDE and replace the indicated values of `REPLACE_ME`. Save it, then run the following command to create the service:

```
aws ecs create-service --cli-input-json file://~/environment/aws-modern-application-workshop/module-2/aws-cli/service-definition.json
Expand Down

0 comments on commit 3c9d568

Please sign in to comment.