AWSCostConsent.tsx 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. import React, { useState, useContext } from "react";
  2. import styled from "styled-components";
  3. import { Context } from "shared/Context";
  4. import api from "shared/api";
  5. import Modal from "./porter/Modal";
  6. import Text from "./porter/Text";
  7. import Spacer from "./porter/Spacer";
  8. import Fieldset from "./porter/Fieldset";
  9. import Button from "./porter/Button";
  10. import ExpandableSection from "./porter/ExpandableSection";
  11. import Input from "./porter/Input";
  12. import Link from "./porter/Link";
  13. type Props = {
  14. setCurrentStep: (step: string) => void;
  15. setShowCostConfirmModal: (show: boolean) => void;
  16. markCostConsentComplete: () => void;
  17. };
  18. const AWSCostConsent: React.FC<Props> = ({
  19. setCurrentStep,
  20. setShowCostConfirmModal,
  21. markCostConsentComplete,
  22. }) => {
  23. const [confirmCost, setConfirmCost] = useState("");
  24. return (
  25. <>
  26. <Modal
  27. closeModal={() => {
  28. setConfirmCost("");
  29. setShowCostConfirmModal(false);
  30. }}
  31. >
  32. <Text size={16}>Base AWS cost consent</Text>
  33. <Spacer height="15px" />
  34. <Text color="helper">
  35. Porter will create the underlying infrastructure in your own AWS
  36. account. You will be separately charged by AWS for this
  37. infrastructure. The cost for this base infrastructure is as follows:
  38. </Text>
  39. <Spacer y={1} />
  40. <ExpandableSection
  41. noWrapper
  42. expandText="[+] Show details"
  43. collapseText="[-] Hide details"
  44. Header={<Text size={20} weight={600}>$224.58 / mo</Text>}
  45. ExpandedSection={
  46. <>
  47. <Spacer height="15px" />
  48. <Fieldset background="#1b1d2688">
  49. • Amazon Elastic Kubernetes Service (EKS) = $73/mo
  50. <Spacer height="15px" />
  51. • Amazon EC2:
  52. <Spacer height="15px" />
  53. <Tab />+ System workloads: t3.medium instance (2) = $60.74/mo
  54. <Spacer height="15px" />
  55. <Tab />+ Monitoring workloads: t3.large instance (1) = $60.74/mo
  56. <Spacer height="15px" />
  57. <Tab />+ Application workloads: t3.medium instance (1) =
  58. $30.1/mo
  59. </Fieldset>
  60. </>
  61. }
  62. />
  63. <Spacer y={1} />
  64. <Text color="helper">
  65. The base AWS infrastructure covers up to 2 vCPU and 4GB of RAM.
  66. Separate from the AWS cost, Porter charges based on your resource
  67. usage.
  68. </Text>
  69. <Spacer inline width="5px" />
  70. <Spacer y={0.5} />
  71. <Link hasunderline to="https://porter.run/pricing" target="_blank">
  72. Learn more about our pricing.
  73. </Link>
  74. <Spacer y={0.5} />
  75. <Text color="helper">
  76. You can use your AWS credits to pay for the underlying infrastructure,
  77. and if you are a startup with less than 5M in funding, you may qualify
  78. for our startup program that gives you $10k in credits.
  79. </Text>
  80. <Spacer y={0.5} />
  81. <Link
  82. hasunderline
  83. to="https://gcpjnf9adme.typeform.com/to/vUg9SDWf"
  84. target="_blank"
  85. >
  86. You can apply here.
  87. </Link>
  88. <Spacer y={0.5} />
  89. <Text color="helper">
  90. All AWS resources will be automatically deleted when you delete your
  91. Porter project. Please enter the AWS base cost ("224.58") below to
  92. proceed:
  93. </Text>
  94. <Spacer y={1} />
  95. <Input
  96. placeholder="224.58"
  97. value={confirmCost}
  98. setValue={setConfirmCost}
  99. width="100%"
  100. height="40px"
  101. />
  102. <Spacer y={1} />
  103. <Button
  104. disabled={confirmCost !== "224.58"}
  105. onClick={() => {
  106. setShowCostConfirmModal(false);
  107. setConfirmCost("");
  108. markCostConsentComplete();
  109. setCurrentStep("credentials");
  110. }}
  111. >
  112. Continue
  113. </Button>
  114. </Modal>
  115. </>
  116. );
  117. };
  118. export default AWSCostConsent;
  119. const Tab = styled.span`
  120. margin-left: 20px;
  121. height: 1px;
  122. `;