diff --git a/README.md b/README.md index 7abcaaf8..8241da1b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## Ec2 Spot Workshops +## EC2 Spot Workshops Collection of workshops to demonstrate best practices in using Amazon EC2 Spot Instances. https://aws.amazon.com/ec2/spot/ @@ -11,7 +11,7 @@ The content of the workshops is built using [hugo](https://gohugo.io/). ### Local Build To build the content * clone this repository - * [install hugo](https://gohugo.io/getting-started/installing/) + * [install hugo](https://gohugo.io/getting-started/installing/). The website is currently running on Hugo 0.53, since we have some markdown issues with the latest versions. You can download the exact version here: https://github.com/gohugoio/hugo/releases/download/v0.53/hugo_0.53_Linux-64bit.tar.gz * The project uses [hugo learn](https://github.com/matcornic/hugo-theme-learn/) template as a git submodule. To update the content, execute the following code ```bash pushd themes/learn diff --git a/config.toml b/config.toml index 999ad258..6cb13715 100644 --- a/config.toml +++ b/config.toml @@ -5,8 +5,6 @@ theme = "learn" uglyurls = true sectionPagesMenu = "main" pygmentsCodeFences = true -googleAnalytics = "UA-136840914-1" - [blackfriday] hrefTargetBlank = true @@ -25,28 +23,30 @@ disableInlineCopyToClipBoard = true home = [ "HTML", "AMP", "RSS", "JSON"] page = [ "HTML", "AMP"] - +# All privacy options enabled. There should not be +# any cookies or privacy [privacy] [privacy.disqus] disable = false [privacy.googleAnalytics] - anonymizeIP = false - disable = false + anonymizeIP = true + disable = true respectDoNotTrack = true useSessionStorage = false [privacy.instagram] - disable = false + disable = true simple = false [privacy.twitter] - disable = false + disable = true enableDNT = false simple = false [privacy.vimeo] - disable = false + disable = true simple = false [privacy.youtube] disable = false - privacyEnhanced = false + # This is required to avoid cookies on youtube integration + privacyEnhanced = true [[menu.shortcuts]] diff --git a/content/nextflow-on-aws-batch/10_prerequisites/nf_aws_event.md b/content/nextflow-on-aws-batch/10_prerequisites/nf_aws_event.md index 9313d732..9dc299fe 100644 --- a/content/nextflow-on-aws-batch/10_prerequisites/nf_aws_event.md +++ b/content/nextflow-on-aws-batch/10_prerequisites/nf_aws_event.md @@ -8,7 +8,7 @@ weight: 20 {{% notice warning %}} Only complete this section if you are at an AWS hosted event (such as re:Invent, -Kubecon, Immersion Day, or any other event hosted by an AWS employee). If you are running the workshop on your own, go to: [Start the workshop on your own]({{< relref "self_paced.md" >}}). +Kubecon, Immersion Day, or any other event hosted by an AWS employee). If you are running the workshop on your own, go to: [Start the workshop on your own]({{< relref "nf_self_paced.md" >}}). {{% /notice %}} ### Login to the AWS Workshop Portal diff --git a/content/nextflow-on-aws-batch/10_prerequisites/nf_self_paced.md b/content/nextflow-on-aws-batch/10_prerequisites/nf_self_paced.md index 7d2c1aa5..f1fc1baa 100644 --- a/content/nextflow-on-aws-batch/10_prerequisites/nf_self_paced.md +++ b/content/nextflow-on-aws-batch/10_prerequisites/nf_self_paced.md @@ -5,7 +5,7 @@ weight: 10 --- {{% notice warning %}} -Only complete this section if you are running the workshop on your own. If you are at an AWS hosted event (such as re:Invent, Kubecon, Immersion Day, etc), go to [Start the workshop at an AWS event]({{< relref "aws_event.md" >}}). +Only complete this section if you are running the workshop on your own. If you are at an AWS hosted event (such as re:Invent, Kubecon, Immersion Day, etc), go to [Start the workshop at an AWS event]({{< relref "nf_aws_event.md" >}}). {{% /notice %}} ### Prepare for CleanUp diff --git a/content/resources.md b/content/resources.md index 2eaea10e..1aa1dbab 100644 --- a/content/resources.md +++ b/content/resources.md @@ -16,9 +16,9 @@ disableToc: true ##### [ - [Blog post] New – EC2 Auto Scaling Groups With Multiple Instance Types & Purchase Options](https://aws.amazon.com/blogs/aws/new-ec2-auto-scaling-groups-with-multiple-instance-types-purchase-options/) - ##### [ - [Blog post] Capacity-Optimized Spot Instance Allocation in Action at Mobileye and Skyscanner](https://aws.amazon.com/blogs/aws/capacity-optimized-spot-instance-allocation-in-action-at-mobileye-and-skyscanner/) +##### [ - [Blog post] Proactively manage the Spot Instance lifecycle using the new Capacity Rebalancing feature for EC2 Auto Scaling](https://aws.amazon.com/blogs/compute/proactively-manage-spot-instance-lifecycle-using-the-new-capacity-rebalancing-feature-for-ec2-auto-scaling/) ##### [ - [AWS Online Tech Talks]: Optimize AI/ML, Kubernetes and Big Data Workloads at Your Startup](https://www.youtube.com/watch?v=2donGftFSIY) @@ -33,6 +33,8 @@ disableToc: true ## Big-data and analytics +##### [ - [Blog post] Optimizing Amazon EMR for resilience and cost with capacity-optimized Spot Instances](https://aws.amazon.com/blogs/big-data/optimizing-amazon-emr-for-resilience-and-cost-with-capacity-optimized-spot-instances/) + ##### [ - [Blog post] Best practices for running Apache Spark applications using Amazon EC2 Spot Instances with Amazon EMR](https://aws.amazon.com/blogs/big-data/best-practices-for-running-apache-spark-applications-using-amazon-ec2-spot-instances-with-amazon-emr/) ##### [ - [Tutorial] Getting started tutorial: Optimizing Amazon EMR clusters for cost and scale with EC2 Spot Instances and Amazon EMR](https://aws.amazon.com/getting-started/hands-on/optimize-amazon-emr-clusters-with-ec2-spot/) diff --git a/content/running-amazon-ec2-workloads-at-scale/create_asg.md b/content/running-amazon-ec2-workloads-at-scale/create_asg.md index 101cc1a2..78055df2 100644 --- a/content/running-amazon-ec2-workloads-at-scale/create_asg.md +++ b/content/running-amazon-ec2-workloads-at-scale/create_asg.md @@ -12,7 +12,7 @@ sed -i.bak -e "s#%TargetGroupARN%#$tg_arn#g" -e "s/%publicSubnet1%/$publicSubnet **Challenge** -The EC2 Auto Scaling group that you are going to deploy supports [multiple purchase options (On-Demand and Spot Instances) and EC2 instance types](https://docs.aws.amazon.com/autoscaling/ec2/serguide/asg-purchase-options.html). +The EC2 Auto Scaling group that you are going to deploy supports [multiple purchase options (On-Demand and Spot Instances) and EC2 instance types](https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html). * Examining the asg.json configuration file, can you determine what would be the different configuration options in the deployed ASG? * How many On-Demand and Spot Instances would be deployed? diff --git a/content/using_ec2_spot_instances_with_eks/_index.md b/content/using_ec2_spot_instances_with_eks/_index.md index cf560eba..89edc2fb 100644 --- a/content/using_ec2_spot_instances_with_eks/_index.md +++ b/content/using_ec2_spot_instances_with_eks/_index.md @@ -5,10 +5,10 @@ weight: 50 pre: "" --- -In this workshop, you learn how to provision, manage, and maintain your Amazon Kubernetes -clusters with Amazon EKS at any scale on Spot Instances to architect for optimizations on cost and scale. -We dive deep using hands-on material to provision and scale worker nodes, handle -interruptions, and design for fault tolerance. +In this workshop, you will learn how to provision, manage, and maintain your Kubernetes +clusters with Amazon Elastic Kubernetes Service (Amazon EKS) at any scale on Spot Instances to architect for optimizations on cost and scale. +We will dive deep using hands-on material to provision and scale worker nodes, handle +Spot interruptions, and design for fault tolerance. This workshop is originally based on AWS [EKS Workshop](https://eksworkshop.com/). You can find there more modules and learn about other Amazon Elastic Kubernetes Service best practices. diff --git a/content/using_ec2_spot_instances_with_eks/eksctl/create_eks_cluster_eksctl_command.md b/content/using_ec2_spot_instances_with_eks/eksctl/create_eks_cluster_eksctl_command.md new file mode 100644 index 00000000..6842cf3a --- /dev/null +++ b/content/using_ec2_spot_instances_with_eks/eksctl/create_eks_cluster_eksctl_command.md @@ -0,0 +1,13 @@ +--- +title: "Create EKS cluster Command" +chapter: false +disableToc: true +hidden: true +--- + + +``` +eksctl create cluster --version=1.18 --name=eksworkshop-eksctl --node-private-networking --managed --nodes=2 --alb-ingress-access --region=${AWS_REGION} --node-labels="lifecycle=OnDemand,intent=control-apps" --asg-access +``` diff --git a/content/using_ec2_spot_instances_with_eks/eksctl/launcheks.md b/content/using_ec2_spot_instances_with_eks/eksctl/launcheks.md index be7f7c18..3f18c2a5 100644 --- a/content/using_ec2_spot_instances_with_eks/eksctl/launcheks.md +++ b/content/using_ec2_spot_instances_with_eks/eksctl/launcheks.md @@ -14,20 +14,7 @@ weight: 20 {{%expand "Expand here to see the solution" %}} -Use the [GetCallerIdentity](https://docs.aws.amazon.com/cli/latest/reference/sts/get-caller-identity.html) CLI command to validate that the Cloud9 IDE is using the correct IAM role. - -``` -aws sts get-caller-identity - -``` - -{{% notice note %}} -**Select the tab** and and validate the assumed role… -{{% /notice %}} -{{< tabs name="Region" >}} - {{< tab name="...ON YOUR OWN" include="../prerequisites/on_your_own_validaterole.md" />}} - {{< tab name="...AT AN AWS EVENT" include="../prerequisites/at_an_aws_validaterole.md" />}} -{{< /tabs >}} +{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/prerequisites/validate_workspace_role.md" %}} If you do not see the correct role, please go back and **[validate the IAM role]({{< relref "../prerequisites/update_workspaceiam.md" >}})** for troubleshooting. @@ -37,12 +24,9 @@ If you do see the correct role, proceed to next step to create an EKS cluster. ### Create an EKS cluster -The following command will create an eks cluster with the name `eksworkshop-eksctl` -.It will also create a nodegroup with 2 on-demand instances. +The following command will create an eks cluster with the name `eksworkshop-eksctl`. It will also create a nodegroup with 2 on-demand instances. -``` -eksctl create cluster --version=1.16 --name=eksworkshop-eksctl --node-private-networking --managed --nodes=2 --alb-ingress-access --region=${AWS_REGION} --node-labels="lifecycle=OnDemand,intent=control-apps" --asg-access -``` +{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/eksctl/create_eks_cluster_eksctl_command.md" %}} eksctl allows us to pass parameters to initialize the cluster. While initializing the cluster, eksctl does also allow us to create nodegroups. @@ -52,12 +36,4 @@ The managed nodegroup will have two m5.large nodes and it will bootstrap with th Launching EKS and all the dependencies will take approximately **15 minutes** {{% /notice %}} -The command above, created a **Managed Nodegroup**. [Amazon EKS managed node groups](https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html) automate the provisioning and lifecycle management of nodes. Managed Nodegroups use the latest [EKS-optimized AMIs](https://docs.aws.amazon.com/eks/latest/userguide/eks-optimized-ami.html). The node run in your AWS account provisioned as apart of an EC2 Auto Scaling group that is managed for you by Amazon EKS. This means EKS takes care of the lifecycle management and undifferentiated heavy lifting on operations such as node updates, handling of terminations, gracefully drain of nodes to ensure that your applications stay available. - - - - - - - - +The command above, created a **Managed Nodegroup**. [Amazon EKS managed node groups](https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html) automate the provisioning and lifecycle management of nodes. Managed Nodegroups use the latest [EKS-optimized AMIs](https://docs.aws.amazon.com/eks/latest/userguide/eks-optimized-ami.html). The node run in your AWS account provisioned as apart of an EC2 Auto Scaling group that is managed for you by Amazon EKS. This means EKS takes care of the lifecycle management and undifferentiated heavy lifting on operations such as node updates, handling of terminations, gracefully drain of nodes to ensure that your applications stay available. \ No newline at end of file diff --git a/content/using_ec2_spot_instances_with_eks/eksctl/prerequisites.md b/content/using_ec2_spot_instances_with_eks/eksctl/prerequisites.md index 81807283..368c1bef 100644 --- a/content/using_ec2_spot_instances_with_eks/eksctl/prerequisites.md +++ b/content/using_ec2_spot_instances_with_eks/eksctl/prerequisites.md @@ -6,8 +6,9 @@ weight: 10 For this module, we need to download the [eksctl](https://eksctl.io/) binary: ``` -export EKSCTL_VERSION=0.23.0 -curl --silent --location "https://github.com/weaveworks/eksctl/releases/download/${EKSCTL_VERSION}/eksctl_Linux_amd64.tar.gz" | tar xz -C /tmp +export EKSCTL_VERSION=0.31.0 +curl --silent --location "https://github.com/weaveworks/eksctl/releases/download/${EKSCTL_VERSION}/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp + sudo mv -v /tmp/eksctl /usr/local/bin ``` diff --git a/content/using_ec2_spot_instances_with_eks/eksctl/test.md b/content/using_ec2_spot_instances_with_eks/eksctl/test.md index 9b1d3897..9d979992 100644 --- a/content/using_ec2_spot_instances_with_eks/eksctl/test.md +++ b/content/using_ec2_spot_instances_with_eks/eksctl/test.md @@ -33,3 +33,36 @@ You now have a fully working Amazon EKS Cluster that is ready to use! {{% notice tip %}} Explore the Elastic Kubernetes Service (EKS) section in the AWS Console and the properties of the newly created EKS cluster. {{% /notice %}} + +{{% notice warning %}} +You might see **Error loading Namespaces** while exploring the cluster on the AWS Console. It could be because the console user role doesnt have necessary permissions on the EKS cluster's RBAC configuration in the control plane. Please expand and follow the below instructions to add necessary permissions. +{{% /notice %}} + +{{%expand "Click to reveal detailed instructions" %}} + +### Add your IAM role Arn as cluster-admin on RBAC + +Get the ARN for your IAM role, it should look something like + +``` +arn:aws:iam:::role/ +``` + +Edit the ConfigMap **aws-auth** using the below command + +``` +kubectl edit configmap -n kube-system aws-auth +``` + +Add the below snippet at the end, that will add the IAM role to the **masters** group on EKS cluster RBAC, thereby assigning a **cluster-admin** role on the cluster. Please refer the documentation [here](https://docs.aws.amazon.com/eks/latest/userguide/add-user-role.html) + +Please make sure to replace the `` and `` with your AWS Account Number and IAM Role Name respectively + +``` + - groups: + - system:masters + rolearn: arn:aws:iam:::role/ + username: +``` + +{{% /expand%}} diff --git a/content/using_ec2_spot_instances_with_eks/helm_root/deploy_metric_server.md b/content/using_ec2_spot_instances_with_eks/helm_root/deploy_metric_server.md index ed246485..a9eff3b9 100644 --- a/content/using_ec2_spot_instances_with_eks/helm_root/deploy_metric_server.md +++ b/content/using_ec2_spot_instances_with_eks/helm_root/deploy_metric_server.md @@ -11,7 +11,7 @@ Metrics Server is a cluster-wide aggregator of resource usage data. These metric kubectl create namespace metrics helm install metrics-server \ stable/metrics-server \ - --version 2.10.0 \ + --version 2.11.4 \ --namespace metrics ``` diff --git a/content/using_ec2_spot_instances_with_eks/helm_root/helm_deploy.md b/content/using_ec2_spot_instances_with_eks/helm_root/helm_deploy.md index 2688a037..9281d637 100644 --- a/content/using_ec2_spot_instances_with_eks/helm_root/helm_deploy.md +++ b/content/using_ec2_spot_instances_with_eks/helm_root/helm_deploy.md @@ -26,7 +26,7 @@ Homebrew on macOS. Download the `stable` repository so we have something to start with: ```sh -helm repo add stable https://kubernetes-charts.storage.googleapis.com/ +helm repo add stable https://charts.helm.sh/stable/ helm repo update ``` diff --git a/content/using_ec2_spot_instances_with_eks/helm_root/install_kube_ops_view.md b/content/using_ec2_spot_instances_with_eks/helm_root/install_kube_ops_view.md index 0f8f5444..460b5ffd 100644 --- a/content/using_ec2_spot_instances_with_eks/helm_root/install_kube_ops_view.md +++ b/content/using_ec2_spot_instances_with_eks/helm_root/install_kube_ops_view.md @@ -14,6 +14,7 @@ helm install kube-ops-view \ stable/kube-ops-view \ --set service.type=LoadBalancer \ --set nodeSelector.intent=control-apps \ +--version 1.2.4 \ --set rbac.create=True ``` @@ -32,8 +33,8 @@ helm list should display : ``` -NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE -kube-ops-view 1 Sun Sep 22 11:47:31 2019 DEPLOYED kube-ops-view-1.1.0 0.11 default +NAME NAMESPACE REVISION UPDATED STATUS CHART +kube-ops-view default 1 2020-11-20 05:16:47 deployed kube-ops-view-1.2.4 ``` With this we can explore kube-ops-view output by checking the details about the newly service created. diff --git a/content/using_ec2_spot_instances_with_eks/jenkins/setup_agents.md b/content/using_ec2_spot_instances_with_eks/jenkins/setup_agents.md index b3c8a9d3..7326c5d7 100644 --- a/content/using_ec2_spot_instances_with_eks/jenkins/setup_agents.md +++ b/content/using_ec2_spot_instances_with_eks/jenkins/setup_agents.md @@ -34,6 +34,9 @@ nodeGroups: k8s.io/cluster-autoscaler/node-template/label/lifecycle: Ec2Spot k8s.io/cluster-autoscaler/node-template/label/intent: jenkins-agents k8s.io/cluster-autoscaler/node-template/label/aws.amazon.com/spot: "true" + iam: + withAddonPolicies: + autoScaler: true EoF ``` @@ -53,10 +56,10 @@ The creation of the workers will take about 3 minutes. #### Instructing Jenkins to run jobs on the new, Spot dedicated nodegroup 1. In the Jenkins dashboard, browse to **Manage Jenkins** -> **Manage Node and Clouds** 1. On the left hand side click on the **Configure Clouds** link. That will take you to the cloud configuration where Kubernetes. -1. Click on the **Pod Templates...** button to expand the default pod template definition and then click again on **Pod Template Details...*** -1. Change the default pod name, attribute **Name** from `defualt` to `jenkins-agent`. We want to be able to identify the pods that are running in our clusters by name. +1. Click on the **Pod Templates...** button to expand the default pod template definition and then click again on **Pod Template Details...*** +1. Change the default pod name, attribute **Name** from `defualt` to `jenkins-agent`. We want to be able to identify the pods that are running in our clusters by name. ![Jenkins Pod Setup 1](/images/using_ec2_spot_instances_with_eks/jenkins/jenkinslabels-1.png) -1. At the bottom of the page, near the end of the Pod template section, In the **Node Selector** Pod , add the following: `intent=jenkins-agents,lifecycle=Ec2Spot` +1. At the bottom of the page, near the end of the Pod template section, for the **Node Selector** parameter , add the following: `intent=jenkins-agents,lifecycle=Ec2Spot` in order to instruct the Jenkins agent pods to run on the dedicated node group. ![Jenkins Pod Setup 2](/images/using_ec2_spot_instances_with_eks/jenkins/jenkinslabels-2.png) 1. Click **Save** diff --git a/content/using_ec2_spot_instances_with_eks/jenkins/setup_jenkins.md b/content/using_ec2_spot_instances_with_eks/jenkins/setup_jenkins.md index 00975d48..dada13c3 100644 --- a/content/using_ec2_spot_instances_with_eks/jenkins/setup_jenkins.md +++ b/content/using_ec2_spot_instances_with_eks/jenkins/setup_jenkins.md @@ -7,7 +7,7 @@ weight: 30 #### Install Jenkins ``` -helm install cicd stable/jenkins --set rbac.create=true,master.servicePort=80,master.serviceType=LoadBalancer +helm install cicd jenkinsci/jenkins --set rbac.create=true,master.servicePort=80,master.serviceType=LoadBalancer,master.JCasC.enabled=false,master.enableXmlConfig=true ``` The output of this command will give you some additional information such as the diff --git a/content/using_ec2_spot_instances_with_eks/prerequisites/at_an_aws_updateiam.md b/content/using_ec2_spot_instances_with_eks/prerequisites/at_an_aws_updateiam.md index b7843343..3c6808cf 100644 --- a/content/using_ec2_spot_instances_with_eks/prerequisites/at_an_aws_updateiam.md +++ b/content/using_ec2_spot_instances_with_eks/prerequisites/at_an_aws_updateiam.md @@ -7,8 +7,8 @@ hidden: true ## Attach the IAM role to your Workspace -1. Follow [this deep link to find your Cloud9 EC2 instance](https://console.aws.amazon.com/ec2/v2/home?#Instances:tag:Name=aws-cloud9-.*workshop.*;sort=desc:launchTime) -1. Select the instance, then choose **Actions / Instance Settings / Attach/Replace IAM Role** +1. Follow this [deep link to find your Cloud9 EC2 instance](https://console.aws.amazon.com/ec2/v2/home?#Instances:tag:Name=aws-cloud9-eksworkshop;sort=desc:launchTime). +1. Select the instance, then choose **Actions / Security / Modify IAM role** ![c9instancerole](/images/using_ec2_spot_instances_with_eks/prerequisites/c9instancerole.png) -1. Choose **TeamRoleInstance** from the **IAM Role** drop down, and select **Apply** +1. Choose **TeamRoleInstance** from the **IAM role** drop down, and select **Save** ![c9attachrole](/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachroleee.png) diff --git a/content/using_ec2_spot_instances_with_eks/prerequisites/aws_event.md b/content/using_ec2_spot_instances_with_eks/prerequisites/aws_event.md index e4a2fb24..2a59556f 100644 --- a/content/using_ec2_spot_instances_with_eks/prerequisites/aws_event.md +++ b/content/using_ec2_spot_instances_with_eks/prerequisites/aws_event.md @@ -23,4 +23,66 @@ If you are at an AWS event, an AWS account was created for you to use throughout You are now logged in to the AWS console in an account that was created for you, and will be available only throughout the workshop run time. -Once you have completed the step above, **you can head straight to [Create a Workspace]({{< relref "workspace.md" >}})** +{{% notice info %}} +In the interest of time for shorter events we sometimes deploy the resources required as a prerequisite for you. If you were told so, please review the cloudformation outputs of the stack that was deployed by **expanding the instructions below**. +{{% /notice %}} + +{{%expand "Click to reveal detailed instructions" %}} + +#### What resources are already deployed {#resources_deployed} + +We have deployed the below resources required to get started with the workshop using a CloudFormation Template (**[eks-spot-workshop-quickstarter-cnf.yml] (prerequisites.files/eks-spot-workshop-quickstart-cnf.yml)**), Please reference the below resources created by the stack. + ++ An [AWS Cloud9](https://console.aws.amazon.com/cloud9) workspace with + - An IAM role created and attached to the workspace with Administrator access + - Kubernetes tools installed (kubectl, jq and envsubst) + - awscli upgraded to v2 + - Created and imported a key pair to Amazon EC2 + - [eksctl](https://eksctl.io/) installed, The official CLI for Amazon EKS + ++ An EKS cluster with the name `eksworkshop-eksctl` and a [EKS managed node group](https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html) with 2 on-demand instances. + +{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/eksctl/create_eks_cluster_eksctl_command.md" %}} + + +#### Use your resources + +In this workshop, you'll need to reference the resources created by the CloudFormation stack that we setup for you. + +1. On the [AWS CloudFormation console](https://console.aws.amazon.com/cloudformation), select the stack name that starts with **mod-** in the list. + +1. In the stack details pane, click the **Outputs** tab. + +![cnf_output](/images/using_ec2_spot_instances_with_eks/prerequisites/cnf_output.png) + +It is recommended that you keep this window open so you can easily refer to the outputs and resources throughout the workshop. + +{{% notice info %}} +you will notice additional Cloudformation stacks were also deployed which is the result of the stack that starts with **mod-**. One to deploy the Cloud9 Workspace and two other to create the EKS cluster and managed nodegroup. +{{% /notice %}} + +#### Launch your Cloud9 workspace + +- Click on the url against `Cloud9IDE` from the outputs + +{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/prerequisites/workspace_at_launch.md" %}} + +{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/prerequisites/update_workspace_settings.md" %}} + +### Validate the IAM role {#validate_iam} + +Use the [GetCallerIdentity](https://docs.aws.amazon.com/cli/latest/reference/sts/get-caller-identity.html) CLI command to validate that the Cloud9 IDE is using the correct IAM role. + +``` +aws sts get-caller-identity + +``` + +{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/prerequisites/at_an_aws_validaterole.md" %}} + +{{% notice note %}} +Since we have already setup the prerequisites, **you can head straight to [Test the Cluster]({{< relref "../eksctl/test.md" >}})** +{{% /notice %}} + +{{% /expand%}} + diff --git a/content/using_ec2_spot_instances_with_eks/prerequisites/k8stools.md b/content/using_ec2_spot_instances_with_eks/prerequisites/k8stools.md index 1eb4f9f8..4ea3454c 100644 --- a/content/using_ec2_spot_instances_with_eks/prerequisites/k8stools.md +++ b/content/using_ec2_spot_instances_with_eks/prerequisites/k8stools.md @@ -14,8 +14,9 @@ for the download links.](https://docs.aws.amazon.com/eks/latest/userguide/gettin {{% /notice %}} #### Install kubectl + ``` -export KUBECTL_VERSION=v1.16.12 +export KUBECTL_VERSION=v1.18.12 sudo curl --silent --location -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl sudo chmod +x /usr/local/bin/kubectl ``` @@ -31,4 +32,4 @@ for command in kubectl jq envsubst do which $command &>/dev/null && echo "$command in path" || echo "$command NOT FOUND" done -``` +``` \ No newline at end of file diff --git a/content/using_ec2_spot_instances_with_eks/prerequisites/on_your_own_updateiam.md b/content/using_ec2_spot_instances_with_eks/prerequisites/on_your_own_updateiam.md index 9d8f5250..5afbf2a7 100644 --- a/content/using_ec2_spot_instances_with_eks/prerequisites/on_your_own_updateiam.md +++ b/content/using_ec2_spot_instances_with_eks/prerequisites/on_your_own_updateiam.md @@ -7,8 +7,8 @@ hidden: true ## Create an IAM role for your Workspace -1. Follow [this deep link to create an IAM role with Administrator access.](https://console.aws.amazon.com/iam/home#/roles$new?step=review&commonUseCase=EC2%2BEC2&selectedUseCase=EC2&policies=arn:aws:iam::aws:policy%2FAdministratorAccess) -1. Confirm that **AWS service** and **EC2** are selected, then click **Next** to view permissions. +1. Follow this [deep link to create an IAM role with Administrator access](https://console.aws.amazon.com/iam/home#/roles$new?step=review&commonUseCase=EC2%2BEC2&selectedUseCase=EC2&policies=arn:aws:iam::aws:policy%2FAdministratorAccess). +1. Confirm that **AWS service** and **EC2** are selected, then click **Next: Permisssions** to view permissions. 1. Confirm that **AdministratorAccess** is checked, then click **Next: Tags** to assign tags. 1. Take the defaults, and click **Next: Review** to review. 1. Enter **eksworkshop-admin** for the Name, and click **Create role**. @@ -16,8 +16,8 @@ hidden: true ## Attach the IAM role to your Workspace -1. Follow [this deep link to find your Cloud9 EC2 instance](https://console.aws.amazon.com/ec2/v2/home?#Instances:tag:Name=aws-cloud9-.*workshop.*;sort=desc:launchTime) -1. Select the instance, then choose **Actions / Instance Settings / Attach/Replace IAM Role** +1. Follow this [deep link to find your Cloud9 EC2 instance](https://console.aws.amazon.com/ec2/v2/home?#Instances:tag:Name=aws-cloud9-eksworkshop;sort=desc:launchTime). +1. Select the instance, then choose **Actions / Security / Modify IAM role** ![c9instancerole](/images/using_ec2_spot_instances_with_eks/prerequisites/c9instancerole.png) -1. Choose **eksworkshop-admin** from the **IAM Role** drop down, and select **Apply** +1. Choose **eksworkshop-admin** from the **IAM role** drop down, and select **Save** ![c9attachrole](/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachrole.png) \ No newline at end of file diff --git a/content/using_ec2_spot_instances_with_eks/prerequisites/prerequisites.files/eks-spot-workshop-quickstart-cnf.yml b/content/using_ec2_spot_instances_with_eks/prerequisites/prerequisites.files/eks-spot-workshop-quickstart-cnf.yml new file mode 100644 index 00000000..a94368a0 --- /dev/null +++ b/content/using_ec2_spot_instances_with_eks/prerequisites/prerequisites.files/eks-spot-workshop-quickstart-cnf.yml @@ -0,0 +1,352 @@ +--- +AWSTemplateFormatVersion: '2010-09-09' +Description: AWS CloudFormation template to create a Cloud9 environment setup with kubectl, eksctl and an EKS cluster with a managed node group. Please allow ~20min for the EKS cluster to be ready. +Metadata: + Author: + Description: Sandeep Palavalasa + License: + Description: 'Copyright 2020 Amazon.com, Inc. and its affiliates. All Rights Reserved. + + Licensed under the Amazon Software License (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/asl/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under the License.' + +Parameters: + C9InstanceType: + Description: Example Cloud9 instance type + Type: String + Default: t3.small + AllowedValues: + - t3.small + - t3.medium + ConstraintDescription: Must be a valid Cloud9 instance type + C9KubectlVersion: + Description: Cloud9 instance kubectl version + Type: String + Default: v1.18.12 + ConstraintDescription: Must be a valid kubectl version + C9KubectlVersionTEST: + Description: Cloud9 instance kubectl version + Type: String + Default: v1.18.12 + ConstraintDescription: Must be a valid kubectl version + C9EKSctlVersion: + Description: Cloud9 instance eksctl version + Type: String + Default: 0.31.0 + ConstraintDescription: Must be a valid eksctl version + EKSClusterVersion: + Description: EKS Cluster Vesion + Type: String + Default: 1.18 + ConstraintDescription: Must be a valid eks version + EKSClusterName: + Description: EKS Cluster Name + Type: String + Default: eksworkshop-eksctl + ConstraintDescription: Must be a valid eks version + #Used only by Event Engine, if you are self-deploying the stack leave the default value to NONE + EETeamRoleArn: + Description: "ARN of the Team Role" + Default: NONE + Type: String + ConstraintDescription: This is ONLY used Event Engine, dont change this if you are self-deploying the stack + +Conditions: + NotEventEngine: !Equals [!Ref EETeamRoleArn, NONE] + +Resources: + +################## PERMISSIONS AND ROLES ################# + C9Role: + Type: AWS::IAM::Role + Condition: NotEventEngine + Properties: + Tags: + - Key: Environment + Value: AWS Example + AssumeRolePolicyDocument: + Version: '2012-10-17' + Statement: + - Effect: Allow + Principal: + Service: + - ec2.amazonaws.com + - ssm.amazonaws.com + Action: + - sts:AssumeRole + ManagedPolicyArns: + - arn:aws:iam::aws:policy/AdministratorAccess + Path: "/" + C9LambdaExecutionRole: + Type: AWS::IAM::Role + Properties: + AssumeRolePolicyDocument: + Version: '2012-10-17' + Statement: + - Effect: Allow + Principal: + Service: + - lambda.amazonaws.com + Action: + - sts:AssumeRole + Path: "/" + Policies: + - PolicyName: + Fn::Join: + - '' + - - C9LambdaPolicy- + - Ref: AWS::Region + PolicyDocument: + Version: '2012-10-17' + Statement: + - Effect: Allow + Action: + - logs:CreateLogGroup + - logs:CreateLogStream + - logs:PutLogEvents + Resource: arn:aws:logs:*:*:* + - Effect: Allow + Action: + - cloudformation:DescribeStacks + - cloudformation:DescribeStackEvents + - cloudformation:DescribeStackResource + - cloudformation:DescribeStackResources + - ec2:DescribeInstances + - ec2:AssociateIamInstanceProfile + - ec2:ModifyInstanceAttribute + - ec2:ReplaceIamInstanceProfileAssociation + - iam:ListInstanceProfiles + - iam:PassRole + Resource: "*" + +################## LAMBDA BOOTSTRAP FUNCTION ################ + + C9BootstrapInstanceLambda: + Description: Bootstrap Cloud9 instance + Type: Custom::C9BootstrapInstanceLambda + DependsOn: + - C9BootstrapInstanceLambdaFunction + - C9Instance + - C9LambdaExecutionRole + Properties: + Tags: + - Key: Environment + Value: AWS Example + ServiceToken: + Fn::GetAtt: + - C9BootstrapInstanceLambdaFunction + - Arn + REGION: + Ref: AWS::Region + StackName: + Ref: AWS::StackName + EnvironmentId: + Ref: C9Instance + LabIdeInstanceProfileArn: !If [ NotEventEngine, !GetAtt C9InstanceProfile.Arn, !Sub 'arn:aws:iam::${AWS::AccountId}:instance-profile/TeamRoleInstanceProfile' ] + + C9BootstrapInstanceLambdaFunction: + Type: AWS::Lambda::Function + Properties: + Tags: + - Key: Environment + Value: AWS Example + Handler: index.lambda_handler + Role: + Fn::GetAtt: + - C9LambdaExecutionRole + - Arn + Runtime: python3.6 + MemorySize: 256 + Timeout: '600' + Code: + ZipFile: | + from __future__ import print_function + import boto3 + # import loggings + import json + import os + import time + import traceback + import cfnresponse + + # logger = logging.getLogger() + # logger.setLevel(logging.INFO) + + def lambda_handler(event, context): + # logger.info('event: {}'.format(event)) + # logger.info('context: {}'.format(context)) + responseData = {} + + if event['RequestType'] == 'Create': + try: + # Open AWS clients + ec2 = boto3.client('ec2') + + # Get the InstanceId of the Cloud9 IDE + # print(str({'Name': 'tag:aws:cloud9:environment','Values': [event['ResourceProperties']['EnvironmentId']]})) + instance = ec2.describe_instances(Filters=[{'Name': 'tag:aws:cloud9:environment','Values': [event['ResourceProperties']['EnvironmentId']]}])['Reservations'][0]['Instances'][0] + # logger.info('instance: {}'.format(instance)) + + # Create the IamInstanceProfile request object + iam_instance_profile = { + 'Arn': event['ResourceProperties']['LabIdeInstanceProfileArn'] + } + # logger.info('iam_instance_profile: {}'.format(iam_instance_profile)) + + # Wait for Instance to become ready before adding Role + instance_state = instance['State']['Name'] + # logger.info('instance_state: {}'.format(instance_state)) + while instance_state != 'running': + time.sleep(5) + instance_state = ec2.describe_instances(InstanceIds=[instance['InstanceId']]) + # logger.info('instance_state: {}'.format(instance_state)) + + # attach instance profile + response = ec2.associate_iam_instance_profile(IamInstanceProfile=iam_instance_profile, InstanceId=instance['InstanceId']) + # logger.info('response - associate_iam_instance_profile: {}'.format(response)) + r_ec2 = boto3.resource('ec2') + + responseData = {'Success': 'Started bootstrapping for instance: '+instance['InstanceId']} + cfnresponse.send(event, context, cfnresponse.SUCCESS, responseData, 'CustomResourcePhysicalID') + + except Exception as e: + # logger.error(e, exc_info=True) + responseData = {'Error': traceback.format_exc(e)} + cfnresponse.send(event, context, cfnresponse.FAILED, responseData, 'CustomResourcePhysicalID') +################## SSM BOOTSRAP HANDLER ############### + C9OutputBucket: + Type: AWS::S3::Bucket + DeletionPolicy: Delete + + C9SSMDocument: + Type: AWS::SSM::Document + Properties: + Tags: + - Key: Environment + Value: AWS Example + Content: Yaml + DocumentType: Command + Content: + schemaVersion: '2.2' + description: Bootstrap Cloud9 Instance + mainSteps: + - action: aws:runShellScript + name: C9bootstrap + inputs: + runCommand: + - "#!/bin/bash" + - date + - . /home/ec2-user/.bashrc + - whoami + - !Sub 'echo "export KUBECTL_VERSION=${C9KubectlVersion}"' + - sudo -H -u ec2-user aws sts get-caller-identity + - echo '=== INSTALL kubectl ===' + - !Sub 'export KUBECTL_VERSION=${C9KubectlVersion}' + - sudo curl --silent --location -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl + - sudo chmod +x /usr/local/bin/kubectl + - echo '=== Install JQ and envsubst ===' + - sudo yum -y install jq gettext + - echo '=== Update to the latest AWS CLI ===' + - sudo -H -u ec2-user aws --version + - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" + - unzip awscliv2.zip + - sudo ./aws/install + - . /home/ec2-user/.bash_profile + - sudo -H -u ec2-user aws --version + - echo '=== setup AWS configs ===' + - rm -vf /home/ec2-user/.aws/credentials + - export ACCOUNT_ID=$(aws sts get-caller-identity --output text --query Account) + - export AWS_REGION=$(curl -s 169.254.169.254/latest/dynamic/instance-identity/document | jq -r '.region') + - echo "export ACCOUNT_ID=${ACCOUNT_ID}" >> /home/ec2-user/.bash_profile + - echo "export AWS_REGION=${AWS_REGION}" >> /home/ec2-user/.bash_profile + - sudo -H -u ec2-user aws configure set default.region ${AWS_REGION} + - sudo -H -u ec2-user aws configure get default.region + - sudo -H -u ec2-user aws sts get-caller-identity + - echo '=== Generate SSH key and import to aws ===' + - sudo -H -u ec2-user ssh-keygen -f /home/ec2-user/.ssh/id_rsa1 -P '' + - sudo -H -u ec2-user aws ec2 import-key-pair --key-name "eksworkshop" --public-key-material file:///home/ec2-user/.ssh/id_rsa1.pub + - echo '=== Install EKSCTL ===' + - !Sub 'export EKSCTL_VERSION=${C9EKSctlVersion}' + - curl --silent --location "https://github.com/weaveworks/eksctl/releases/download/${EKSCTL_VERSION}/eksctl_Linux_amd64.tar.gz" | tar xz -C /tmp + - sudo mv -v /tmp/eksctl /usr/local/bin + - sudo -H -u ec2-user /usr/local/bin/eksctl version + - echo '=== Create EKS Cluster ===' + - !Sub 'sudo -H -u ec2-user /usr/local/bin/eksctl create cluster --version=${EKSClusterVersion} --name=${EKSClusterName} --node-private-networking --managed --nodes=2 --alb-ingress-access --region=${AWS::Region} --node-labels="lifecycle=OnDemand,intent=control-apps" --asg-access' + - sudo -H -u ec2-user /usr/local/bin/kubectl get nodes + + C9BootstrapAssociation: + Type: AWS::SSM::Association + DependsOn: + - C9OutputBucket + Properties: + Name: !Ref C9SSMDocument + OutputLocation: + S3Location: + OutputS3BucketName: !Ref C9OutputBucket + OutputS3KeyPrefix: bootstrapoutput + Targets: + - Key: tag:SSMBootstrap + Values: + - Active + +################## INSTANCE ##################### + C9InstanceProfile: + Type: AWS::IAM::InstanceProfile + Condition: NotEventEngine + Properties: + Path: "/" + Roles: + - Ref: C9Role + C9Instance: + Description: "-" + DependsOn: C9BootstrapAssociation + Type: AWS::Cloud9::EnvironmentEC2 + Properties: + Description: AWS Cloud9 instance for Examples + AutomaticStopTimeMinutes: 3600 + InstanceType: + Ref: C9InstanceType + Name: + Ref: AWS::StackName + # OwnerArn: !Sub 'arn:aws:sts::${AWS::AccountId}:assumed-role/TeamRole/MasterKey' + OwnerArn: !If [NotEventEngine , !Ref AWS::NoValue , !Sub 'arn:aws:sts::${AWS::AccountId}:assumed-role/TeamRole/MasterKey'] + Tags: + - + Key: SSMBootstrap + Value: Active + - + Key: Environment + Value: + Ref: AWS::StackName + +Outputs: + Cloud9IDE: + Value: + Fn::Join: + - '' + - - https:// + - Ref: AWS::Region + - ".console.aws.amazon.com/cloud9/ide/" + - Ref: C9Instance + - "?region=" + - Ref: AWS::Region + + EKSCluster: + Value: + Fn::Join: + - '' + - - https:// + - Ref: AWS::Region + - ".console.aws.amazon.com/eks/home" + - "?region=" + - Ref: AWS::Region + - "#/clusters/" + - Ref: EKSClusterName + EKSClusterVersion: + Value: !Ref EKSClusterVersion diff --git a/content/using_ec2_spot_instances_with_eks/prerequisites/update_workspace_settings.md b/content/using_ec2_spot_instances_with_eks/prerequisites/update_workspace_settings.md new file mode 100644 index 00000000..1c886b7e --- /dev/null +++ b/content/using_ec2_spot_instances_with_eks/prerequisites/update_workspace_settings.md @@ -0,0 +1,30 @@ +--- +title: "Update Workshop Settings" +chapter: false +disableToc: true +hidden: true +--- + + +{{% notice info %}} +Cloud9 normally manages IAM credentials dynamically. This isn't currently compatible with +the EKS IAM authentication, so we will disable it and rely on the IAM role instead. +{{% /notice %}} + + +- Return to your workspace and click the sprocket, or launch a new tab to open the Preferences tab +- Select **AWS SETTINGS** +- Turn off **AWS managed temporary credentials** +- Close the Preferences tab +![c9disableiam](/images/using_ec2_spot_instances_with_eks/prerequisites/c9disableiam.png) + +To ensure temporary credentials aren't already in place we will also remove +any existing credentials file: +``` +rm -vf ${HOME}/.aws/credentials +``` + + + diff --git a/content/using_ec2_spot_instances_with_eks/prerequisites/update_workspaceiam.md b/content/using_ec2_spot_instances_with_eks/prerequisites/update_workspaceiam.md index 46c4df5f..ac0c0834 100644 --- a/content/using_ec2_spot_instances_with_eks/prerequisites/update_workspaceiam.md +++ b/content/using_ec2_spot_instances_with_eks/prerequisites/update_workspaceiam.md @@ -4,23 +4,7 @@ chapter: false weight: 60 --- -{{% notice info %}} -Cloud9 normally manages IAM credentials dynamically. This isn't currently compatible with -the EKS IAM authentication, so we will disable it and rely on the IAM role instead. -{{% /notice %}} - - -- Return to your workspace and click the sprocket, or launch a new tab to open the Preferences tab -- Select **AWS SETTINGS** -- Turn off **AWS managed temporary credentials** -- Close the Preferences tab -![c9disableiam](/images/using_ec2_spot_instances_with_eks/prerequisites/c9disableiam.png) - -To ensure temporary credentials aren't already in place we will also remove -any existing credentials file: -``` -rm -vf ${HOME}/.aws/credentials -``` +{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/prerequisites/update_workspace_settings.md" %}} We should configure our aws cli with our current region as default: ``` @@ -33,21 +17,5 @@ aws configure set default.region ${AWS_REGION} aws configure get default.region ``` -### Validate the IAM role {#validate_iam} - -Use the [GetCallerIdentity](https://docs.aws.amazon.com/cli/latest/reference/sts/get-caller-identity.html) CLI command to validate that the Cloud9 IDE is using the correct IAM role. - -``` -aws sts get-caller-identity - -``` - -{{% notice note %}} -**Select the tab** and validate the assumed role… -{{% /notice %}} -{{< tabs name="Region" >}} - {{< tab name="...ON YOUR OWN" include="on_your_own_validaterole.md" />}} - {{< tab name="...AT AN AWS EVENT" include="at_an_aws_validaterole.md" />}} -{{< /tabs >}} - +{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/prerequisites/validate_workspace_role.md" %}} diff --git a/content/using_ec2_spot_instances_with_eks/prerequisites/validate_workspace_role.md b/content/using_ec2_spot_instances_with_eks/prerequisites/validate_workspace_role.md new file mode 100644 index 00000000..01b04d65 --- /dev/null +++ b/content/using_ec2_spot_instances_with_eks/prerequisites/validate_workspace_role.md @@ -0,0 +1,29 @@ +--- +title: "Validate Workshpace Role" +chapter: false +disableToc: true +hidden: true +--- + + +### Validate the IAM role {#validate_iam} + +Use the [GetCallerIdentity](https://docs.aws.amazon.com/cli/latest/reference/sts/get-caller-identity.html) CLI command to validate that the Cloud9 IDE is using the correct IAM role. + +``` +aws sts get-caller-identity + +``` + +{{% notice note %}} +**Select the tab** and validate the assumed role… +{{% /notice %}} + +{{< tabs name="Region" >}} + {{< tab name="...ON YOUR OWN" include="on_your_own_validaterole.md" />}} + {{< tab name="...AT AN AWS EVENT" include="at_an_aws_validaterole.md" />}} +{{< /tabs >}} + + diff --git a/content/using_ec2_spot_instances_with_eks/prerequisites/workspace_at_launch.md b/content/using_ec2_spot_instances_with_eks/prerequisites/workspace_at_launch.md new file mode 100644 index 00000000..bc8505d2 --- /dev/null +++ b/content/using_ec2_spot_instances_with_eks/prerequisites/workspace_at_launch.md @@ -0,0 +1,18 @@ +--- +title: "Workspace at Launch" +chapter: false +disableToc: true +hidden: true +--- + +- When it comes up, customize the environment by closing the **welcome tab** +and **lower work area**, and opening a new **terminal** tab in the main work area: +![c9before](/images/using_ec2_spot_instances_with_eks/prerequisites/c9before.png) + +- Your workspace should now look like this: +![c9after](/images/using_ec2_spot_instances_with_eks/prerequisites/c9after.png) + +- If you like this theme, you can choose it yourself by selecting **View / Themes / Solarized / Solarized Dark** +in the Cloud9 workspace menu. diff --git a/content/using_ec2_spot_instances_with_eks/scaling/deploy_ca.files/cluster_autoscaler.yml b/content/using_ec2_spot_instances_with_eks/scaling/deploy_ca.files/cluster_autoscaler.yml index d0dbebc5..bdc128b0 100644 --- a/content/using_ec2_spot_instances_with_eks/scaling/deploy_ca.files/cluster_autoscaler.yml +++ b/content/using_ec2_spot_instances_with_eks/scaling/deploy_ca.files/cluster_autoscaler.yml @@ -53,6 +53,9 @@ rules: - apiGroups: ["batch"] resources: ["jobs"] verbs: ["watch","list","get"] +- apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get","list","watch","create","update"] --- apiVersion: rbac.authorization.k8s.io/v1beta1 @@ -129,7 +132,7 @@ spec: nodeSelector: intent: control-apps containers: - - image: us.gcr.io/k8s-artifacts-prod/autoscaling/cluster-autoscaler:v1.16.5 + - image: us.gcr.io/k8s-artifacts-prod/autoscaling/cluster-autoscaler:v1.18.3 name: cluster-autoscaler resources: limits: @@ -166,6 +169,4 @@ spec: volumes: - name: ssl-certs hostPath: - path: "/etc/ssl/certs/ca-bundle.crt" - - + path: "/etc/ssl/certs/ca-bundle.crt" \ No newline at end of file diff --git a/content/using_ec2_spot_instances_with_eks/spotworkers/deployhandler.md b/content/using_ec2_spot_instances_with_eks/spotworkers/deployhandler.md index 63116a58..ad928a37 100644 --- a/content/using_ec2_spot_instances_with_eks/spotworkers/deployhandler.md +++ b/content/using_ec2_spot_instances_with_eks/spotworkers/deployhandler.md @@ -29,6 +29,7 @@ This also is our recommendation. Remember the termination handler does also hand helm repo add eks https://aws.github.io/eks-charts helm install aws-node-termination-handler \ --namespace kube-system \ + --version 0.12.0 \ eks/aws-node-termination-handler ``` diff --git a/layouts/partials/custom-footer.html b/layouts/partials/custom-footer.html index 42b02beb..8ff86d51 100644 --- a/layouts/partials/custom-footer.html +++ b/layouts/partials/custom-footer.html @@ -1 +1,20 @@ -{{ template "_internal/google_analytics.html" . }} + + + +
    +
  • + + + + Privacy + +
  • +
  • + + + + Site Terms + +
  • + + diff --git a/layouts/partials/menu-footer.html b/layouts/partials/menu-footer.html index 721c12c7..04905c24 100644 --- a/layouts/partials/menu-footer.html +++ b/layouts/partials/menu-footer.html @@ -1,6 +1,6 @@ -

    Github Repo

    +

    EC2 Spot Workshops

    @@ -9,9 +9,10 @@

    EC2 Spot Workshops

     Fork
    -
    - + {{ partial "custom-footer.html" . }} + +
    diff --git a/layouts/shortcodes/insert-md-from-file.html b/layouts/shortcodes/insert-md-from-file.html new file mode 100644 index 00000000..8fe5f61e --- /dev/null +++ b/layouts/shortcodes/insert-md-from-file.html @@ -0,0 +1,7 @@ +
    + {{ $file := .Get "file" }} + {{ $page := .Site.GetPage $file }} + {{ with $page }} + {{ .Content }} + {{ end }} +
    diff --git a/static/css/theme-mine.css b/static/css/theme-mine.css index 53673b5e..bb8310a1 100644 --- a/static/css/theme-mine.css +++ b/static/css/theme-mine.css @@ -59,14 +59,14 @@ a:hover { padding-top: 20px !important; } -#sidebar #footer h2.github-title { +#sidebar #footer h2.footer-section { font-size: 20px; color: #fd9827 !important; margin: 10px 0px 5px; padding: 0px; font-weight: normal !important; margin-top: 10px; - padding-top: 30px; + padding-top: 5px; border-top: 1px dotted #384657; } @@ -79,9 +79,10 @@ a:hover { } #sidebar #footer h5.copyright, #sidebar #footer p.build-number { - font-size: 10px; + font-size: 15px; letter-spacing: .15px; line-height: 150% !important; + margin: 10px 0px 0px 0px } #body a.highlight:after { @@ -130,6 +131,11 @@ a:hover { #sidebar hr { border-color: var(--MENU-SECTION-HR-color); } +#sidebar #prefooter hr { + border-color: var(--MENU-SECTION-HR-color); + margin-top: 10px; + margin-bottom: 10px; +} #navigation a.nav-prev, #navigation a.nav-next { color: #f19e39 !important; diff --git a/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachrole.png b/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachrole.png index fc26e681..ea680dac 100644 Binary files a/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachrole.png and b/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachrole.png differ diff --git a/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachroleee.png b/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachroleee.png index 83a9e668..00d5c2ac 100644 Binary files a/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachroleee.png and b/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachroleee.png differ diff --git a/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9instancerole.png b/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9instancerole.png index cde240a7..bf00acb8 100644 Binary files a/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9instancerole.png and b/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9instancerole.png differ diff --git a/static/images/using_ec2_spot_instances_with_eks/prerequisites/cnf_output.png b/static/images/using_ec2_spot_instances_with_eks/prerequisites/cnf_output.png new file mode 100644 index 00000000..5eda44b3 Binary files /dev/null and b/static/images/using_ec2_spot_instances_with_eks/prerequisites/cnf_output.png differ diff --git a/workshops/ec2-auto-scaling-with-multiple-instance-types-and-purchase-options/spot-interruption-handler.yaml b/workshops/ec2-auto-scaling-with-multiple-instance-types-and-purchase-options/spot-interruption-handler.yaml index 748a33c8..37dcbec8 100644 --- a/workshops/ec2-auto-scaling-with-multiple-instance-types-and-purchase-options/spot-interruption-handler.yaml +++ b/workshops/ec2-auto-scaling-with-multiple-instance-types-and-purchase-options/spot-interruption-handler.yaml @@ -16,6 +16,7 @@ Resources: DependsOn: - LambdaFunctionRole Properties: + FunctionName: SpotInterruptionHandler Handler: index.handler Role: !GetAtt LambdaFunctionRole.Arn Code: @@ -85,7 +86,8 @@ Resources: Action: - logs:CreateLogStream - logs:PutLogEvents - Resource: arn:aws:logs:*:*:log-group:/aws/lambda/*SpotInterruptionHandlerFunction*:* + Resource: + - !Sub "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/SpotInterruptionHandler:*" - Effect: Allow Action: - logs:CreateLogGroup