[{"data":1,"prerenderedAt":65},["ShallowReactive",2],{"content-guides-serverless-crossplane-on-eks-deployment":3},{"markdown":4,"frontMatterAttributes":5,"bodyRaw":11,"contributorPaths":12,"menuType":14,"contentName":15,"slug":16,"readingTime":17,"menu":18,"nextDocItem":48,"previousDocItem":36},"\u003Cp>In this module, we will be using \u003Ca href=\"https:\u002F\u002Fkubernetes.io\u002Fdocs\u002Freference\u002Fkubectl\u002F\">kubectl\u003C\u002Fa> to deploy Crossplane Resource Definitions (XRDs), Compositions, and a Claim in order to create and deploy the resources for the serverless application.\u003C\u002Fp>\n\u003Ch2>Implementation\u003C\u002Fh2>\n\u003Ch3>Deploy XRDs and Compositions\u003C\u002Fh3>\n\u003Cp>Navigate to the following directory:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-sh\">cd examples\u002Fupbound-aws-provider\u002Fcomposite-resources\u002Fserverless-examples\u002Fsqs-lambda-s3\u002F\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Examine and apply the kustomization.yaml file to create Crossplane XRDs and Compositions using the following command:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-sh\">kubectl apply -k .\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Verify the XRDs\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-sh\">kubectl get xrds\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Expected output\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-sh\">NAME                                   ESTABLISHED   OFFERED   AGE\neventsourcemappings.awsblueprints.io   True                    5m\niampolicies.awsblueprints.io           True                    5m\nxlambdafunctions.awsblueprints.io      True          True      5m\nxobjectstorages.awsblueprints.io       True          True      5m\nxqueues.awsblueprints.io               True          True      5m\nxserverlessapp.awsblueprints.io        True          True      5m\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Verify the Compositions\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-sh\">kubectl get compositions\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Expected output. Note: the output might contain more compositions but these are the ones uses by the claim in the next step\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-sh\">NAME                                                  XR-KIND              XR-APIVERSION               AGE\ncontainer.lambda.aws.upbound.awsblueprints.io         XLambdaFunction      awsblueprints.io\u002Fv1alpha1   5m\nread-s3.iampolicy.awsblueprints.io                    IAMPolicy            awsblueprints.io\u002Fv1alpha1   5m\nread-sqs.iampolicy.awsblueprints.io                   IAMPolicy            awsblueprints.io\u002Fv1alpha1   5m\ns3bucket.awsblueprints.io                             XObjectStorage       awsblueprints.io\u002Fv1alpha1   5m\nsqs.esm.awsblueprints.io                              EventSourceMapping   awsblueprints.io\u002Fv1alpha1   5m\nsqs.queue.aws.upbound.awsblueprints.io                XQueue               awsblueprints.io\u002Fv1alpha1   5m\nwrite-s3.iampolicy.awsblueprints.io                   IAMPolicy            awsblueprints.io\u002Fv1alpha1   5m\nxsqslambdas3.awsblueprints.io                         XServerlessApp       awsblueprints.io\u002Fv1alpha1   5m\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch3>Update and apply the claim\u003C\u002Fh3>\n\u003Cp>Set the image name and AWS region in the claim with the ones set in Module 1 where the docker image is uploaded to ECR.\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-sh\">export AWS_REGION=&lt;replace-with-aws-region&gt; # example `us-east-1`\nexport IMAGE_NAME=&lt;replace-with-image-name&gt; # example `lambda-test`\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Change the default value for CLAIM_NAME with any name you choose.\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-sh\">export CLAIM_NAME=&lt;replace-with-claim-name&gt; # example `test-sqs-lambda-s3`\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Run the below command to use the template file sqs-lambda-s3-claim-tmpl.yaml in the claim folder to create the claim file with the variables CLAIM_NAME, IMAGE_NAME, and AWS_REGION substituted.\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-sh\">envsubst &lt; &quot;claim\u002Fsqs-lambda-s3-claim-tmpl.yaml&quot; &gt; &quot;claim\u002Fsqs-lambda-s3-claim.yaml&quot;\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Check that the claim populated with values\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-sh\">cat claim\u002Fsqs-lambda-s3-claim.yaml\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Apply the claim\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-sh\">kubectl apply -f claim\u002Fsqs-lambda-s3-claim.yaml\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Validate the claim\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-sh\">kubectl get serverlessapps\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Expected result (it might take sometime before READY=True)\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-sh\">NAME                 SYNCED   READY   CONNECTION-SECRET   AGE\ntest-sqs-lambda-s3   True     True                        20m\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>The claim will use the XRDs and Compositions created in the previous section to create the following resources:\u003C\u002Fp>\n\u003Cimg src=\"\u002Fassets\u002Fexternal\u002Fguides\u002Fserverless-crossplane-on-eks\u002Fassets\u002Fs3-irsa_dd-FINAL.png\" \u002F>\n\n\u003Cp>Each XR in the diagram contains the underlying resource refs:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-sh\">kubectl describe xserverlessapp | grep &quot;Resource Refs&quot; -A 18\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Expected output:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-sh\">Resource Refs:\n    API Version:  awsblueprints.io\u002Fv1alpha1\n    Kind:         XQueue\n    Name:         test-sqs-lambda-s3-hc2m5-7qwnb\n    API Version:  awsblueprints.io\u002Fv1alpha1\n    Kind:         EventSourceMapping\n    Name:         test-sqs-lambda-s3-hc2m5-9q2kf\n    API Version:  awsblueprints.io\u002Fv1alpha1\n    Kind:         XLambdaFunction\n    Name:         test-sqs-lambda-s3-hc2m5-processor\n    API Version:  awsblueprints.io\u002Fv1alpha1\n    Kind:         XObjectStorage\n    Name:         test-sqs-lambda-s3-hc2m5-mbqcc\n    API Version:  awsblueprints.io\u002Fv1alpha1\n    Kind:         IAMPolicy\n    Name:         test-sqs-lambda-s3-hc2m5-jspzj\n    API Version:  awsblueprints.io\u002Fv1alpha1\n    Kind:         IAMPolicy\n    Name:         test-sqs-lambda-s3-hc2m5-2qzfl\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch2>Conclusion\u003C\u002Fh2>\n\u003Cp>In this module, we defined and grouped resources using Crossplane’s XRDs and Compositions. We then used a Claim to create those resources in order to deploy a serverless application.\u003C\u002Fp>\n",{"title":6,"order":7,"learningGoals":8},"2. Deploy the serverless application",2,[9,10],"Deploying Crossplane XRDs and Compositions","Deploying a Claim to create serverless application","In this module, we will be using [kubectl](https:\u002F\u002Fkubernetes.io\u002Fdocs\u002Freference\u002Fkubectl\u002F) to deploy Crossplane Resource Definitions (XRDs), Compositions, and a Claim in order to create and deploy the resources for the serverless application.\n\n## Implementation\n\n### Deploy XRDs and Compositions\n\nNavigate to the following directory:\n\n```sh\ncd examples\u002Fupbound-aws-provider\u002Fcomposite-resources\u002Fserverless-examples\u002Fsqs-lambda-s3\u002F\n```\n\nExamine and apply the kustomization.yaml file to create Crossplane XRDs and Compositions using the following command:\n\n```sh\nkubectl apply -k .\n```\n\nVerify the XRDs\n\n```sh\nkubectl get xrds\n```\n\nExpected output\n\n```sh\nNAME                                   ESTABLISHED   OFFERED   AGE\neventsourcemappings.awsblueprints.io   True                    5m\niampolicies.awsblueprints.io           True                    5m\nxlambdafunctions.awsblueprints.io      True          True      5m\nxobjectstorages.awsblueprints.io       True          True      5m\nxqueues.awsblueprints.io               True          True      5m\nxserverlessapp.awsblueprints.io        True          True      5m\n```\n\nVerify the Compositions\n\n```sh\nkubectl get compositions\n```\n\nExpected output. Note: the output might contain more compositions but these are the ones uses by the claim in the next step\n\n```sh\nNAME                                                  XR-KIND              XR-APIVERSION               AGE\ncontainer.lambda.aws.upbound.awsblueprints.io         XLambdaFunction      awsblueprints.io\u002Fv1alpha1   5m\nread-s3.iampolicy.awsblueprints.io                    IAMPolicy            awsblueprints.io\u002Fv1alpha1   5m\nread-sqs.iampolicy.awsblueprints.io                   IAMPolicy            awsblueprints.io\u002Fv1alpha1   5m\ns3bucket.awsblueprints.io                             XObjectStorage       awsblueprints.io\u002Fv1alpha1   5m\nsqs.esm.awsblueprints.io                              EventSourceMapping   awsblueprints.io\u002Fv1alpha1   5m\nsqs.queue.aws.upbound.awsblueprints.io                XQueue               awsblueprints.io\u002Fv1alpha1   5m\nwrite-s3.iampolicy.awsblueprints.io                   IAMPolicy            awsblueprints.io\u002Fv1alpha1   5m\nxsqslambdas3.awsblueprints.io                         XServerlessApp       awsblueprints.io\u002Fv1alpha1   5m\n```\n\n### Update and apply the claim\n\nSet the image name and AWS region in the claim with the ones set in Module 1 where the docker image is uploaded to ECR.\n\n```sh\nexport AWS_REGION=\u003Creplace-with-aws-region> # example `us-east-1`\nexport IMAGE_NAME=\u003Creplace-with-image-name> # example `lambda-test`\n```\n\nChange the default value for CLAIM_NAME with any name you choose.\n\n```sh\nexport CLAIM_NAME=\u003Creplace-with-claim-name> # example `test-sqs-lambda-s3`\n```\n\nRun the below command to use the template file sqs-lambda-s3-claim-tmpl.yaml in the claim folder to create the claim file with the variables CLAIM_NAME, IMAGE_NAME, and AWS_REGION substituted.\n\n```sh\nenvsubst \u003C \"claim\u002Fsqs-lambda-s3-claim-tmpl.yaml\" > \"claim\u002Fsqs-lambda-s3-claim.yaml\"\n```\n\nCheck that the claim populated with values\n\n```sh\ncat claim\u002Fsqs-lambda-s3-claim.yaml\n```\n\nApply the claim\n\n```sh\nkubectl apply -f claim\u002Fsqs-lambda-s3-claim.yaml\n```\n\nValidate the claim\n\n```sh\nkubectl get serverlessapps\n```\n\nExpected result (it might take sometime before READY=True)\n```sh\nNAME                 SYNCED   READY   CONNECTION-SECRET   AGE\ntest-sqs-lambda-s3   True     True                        20m\n```\n\nThe claim will use the XRDs and Compositions created in the previous section to create the following resources:\n\n\u003Cimg src=\"\u002Fassets\u002Fexternal\u002Fguides\u002Fserverless-crossplane-on-eks\u002Fassets\u002Fs3-irsa_dd-FINAL.png\" \u002F>\n\nEach XR in the diagram contains the underlying resource refs:\n\n```sh\nkubectl describe xserverlessapp | grep \"Resource Refs\" -A 18\n```\n\nExpected output:\n\n```sh\nResource Refs:\n    API Version:  awsblueprints.io\u002Fv1alpha1\n    Kind:         XQueue\n    Name:         test-sqs-lambda-s3-hc2m5-7qwnb\n    API Version:  awsblueprints.io\u002Fv1alpha1\n    Kind:         EventSourceMapping\n    Name:         test-sqs-lambda-s3-hc2m5-9q2kf\n    API Version:  awsblueprints.io\u002Fv1alpha1\n    Kind:         XLambdaFunction\n    Name:         test-sqs-lambda-s3-hc2m5-processor\n    API Version:  awsblueprints.io\u002Fv1alpha1\n    Kind:         XObjectStorage\n    Name:         test-sqs-lambda-s3-hc2m5-mbqcc\n    API Version:  awsblueprints.io\u002Fv1alpha1\n    Kind:         IAMPolicy\n    Name:         test-sqs-lambda-s3-hc2m5-jspzj\n    API Version:  awsblueprints.io\u002Fv1alpha1\n    Kind:         IAMPolicy\n    Name:         test-sqs-lambda-s3-hc2m5-2qzfl\n```\n\n## Conclusion\n\nIn this module, we defined and grouped resources using Crossplane’s XRDs and Compositions. We then used a Claim to create those resources in order to deploy a serverless application.",[13],"content\u002Fcontributors\u002Fdavid-boyne.json","LIST","Deploy a Serverless Application using Crossplane on EKS","\u002Fcontent\u002Fguides\u002Fserverless-crossplane-on-eks\u002Fdeployment","3 min",[19,33],{"title":20,"content":21},"Introduction",[22],{"title":23,"order":24,"learningGoals":25,"time":29,"path":30,"id":31,"link":32},"Overview",1,[26,27,28],"Create a Docker image and push it to ECR.","Set Crossplane underlying Compositions and XRDs, and use Claims.","Validate results with basic commands using kubectl and the AWS CLI.","2 min","introduction","introduction.md","\u002Fcontent\u002Fguides\u002Fserverless-crossplane-on-eks\u002Fintroduction",{"title":34,"content":35},"Modules",[36,44,48,57],{"title":37,"order":7,"learningGoals":38,"time":29,"path":41,"id":42,"link":43},"1. Build a docker image and push to ECR",[39,40],"Building a Docker image from a given application","Creating an ECR repo and uploading an image to it using the AWS CLI","docker-image","docker-image.md","\u002Fcontent\u002Fguides\u002Fserverless-crossplane-on-eks\u002Fdocker-image",{"title":6,"order":7,"learningGoals":45,"time":17,"path":46,"id":47,"link":16},[9,10],"deployment","deployment.md",{"title":49,"order":7,"learningGoals":50,"time":53,"path":54,"id":55,"link":56},"3. Test",[51,52],"Pushing messages to SQS using the AWS CLI.","Exploring the AWS SQS, Lambda, and S3 consoles.","1 min","testing","testing.md","\u002Fcontent\u002Fguides\u002Fserverless-crossplane-on-eks\u002Ftesting",{"title":58,"order":7,"learningGoals":59,"time":53,"path":62,"id":63,"link":64},"4. Clean up resources",[60,61],"How to remove Crossplane resources","How to destroy EKS cluster if created using the GitHub repository.","cleanup","cleanup.md","\u002Fcontent\u002Fguides\u002Fserverless-crossplane-on-eks\u002Fcleanup",1792578866290]