<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Daniel Pereira on Medium]]></title>
        <description><![CDATA[Stories by Daniel Pereira on Medium]]></description>
        <link>https://medium.com/@daniel.pereira?source=rss-11f074faffa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*H3kg5ZmxxbJgRIX4yM8mBQ.jpeg</url>
            <title>Stories by Daniel Pereira on Medium</title>
            <link>https://medium.com/@daniel.pereira?source=rss-11f074faffa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 04:47:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@daniel.pereira/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Kubernetes — an overview]]></title>
            <link>https://medium.com/just-another-dev-blog/kubernetes-an-overview-bf47b0af1865?source=rss-11f074faffa------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf47b0af1865</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Daniel Pereira]]></dc:creator>
            <pubDate>Wed, 22 Feb 2017 00:59:49 GMT</pubDate>
            <atom:updated>2017-02-22T00:59:49.187Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*SIKE2jGRRrdbN_F1T2Em1Q.png" /></figure><p>Kubernetes is an open source system for automating deployment, scaling, and management of containerized applications. It was started by Google in 2014 and later donated to the Cloud Native Computing Foundation.</p><p>With Kubernetes we can quickly deploy our applications, scaling it according to our needs, without having to stop anything in the process. It is made to be portable, extensive and self-healing, granting an easier management from people who have to administrate the system.</p><p>The system has some key concepts, which are:</p><ul><li>Nodes</li><li>Pods</li><li>Deployments</li><li>Services</li></ul><p>This post aims to give a brief introduction to these concepts, helping to understand how Kubernetes works.</p><h3>Nodes</h3><p>Nodes, previously known as minions, are the machines on Kubernetes. They can be either a physical or a virtual machine. When reading the statuses of a Node we can get the following information:</p><ul><li><strong>Addresses</strong>: here we can obtain the hostname, internal and external IP addresses from the Node.</li><li><strong>Condition</strong>: there are two conditions: <em>OutOfDisk</em> and <em>Ready</em>. <em>OutOfDisk</em> will be true when there is insufficient space to add new pods. <em>Ready</em> will tell if the Node is healthy and ready to accept pods. If the Controller can not reach the Node for 40 seconds the <em>Ready</em> condition is set to <em>Unknow</em>.</li><li><strong>Capacity</strong>: the resources available in the node, such as CPU, memory and the maximum number of pods allowed.</li><li><strong>Info</strong>: general information about the node, such as program versions and OS name.</li></ul><p>Unlike some cloud services like ECS, Kubernetes node creation doesn’t actually create the machine, we must create it in our desired environment (e.g. AWS EC2, on-premises) and pass the proper configuration to the system. When we ask Kubernetes to create a node it just creates a representation to properly manage the resources available. Kubernetes will perform health checks to verify is a node is healthy. If so, the given node is available to receive Pods.</p><p>To control the nodes we have Node Controllers. It’s their responsibility to assign a CIDR block to the node when it is registered, which will ensure the proper IP is set. They also keep track of the relation between the list of nodes available and the list of machines available: when a node is deemed unhealthy the Controller will check if the machine is unhealthy as well. If that is the case, the node is removed from the list of available nodes.</p><h3>Pods</h3><p>Pods are composed of a group of one or more containers, the shared storage for them and their options. Kubernetes supports many types of containers, being Docker the most common one.</p><p>Every container inside a pod will have the same IP address. As expected in this case, they can found themselves by calling <em>localhost</em>. This is valid only on containers running on the same pod, though: if we have two containers located in two different pods they will have different IPs and cannot find each other using <em>localhost</em>.</p><p>Pods should not be treated as persistent entities. In a case of some failure (e.g. node failure) they will be destroyed, which means we shouldn’t use them as a place to hold vital information. Data that needs to outlive the pod should be stored in volumes. Since pods are intended to be ephemeral it is important to understand their lifecycle.</p><p>Each pod will have a phase, which can be described as a high-level summary of the current status of the pod in the lifecycle. A phase can assume the following values:</p><ul><li><strong>Pending</strong>: the pod was already accepted by Kubernetes, but that are images still being created.</li><li><strong>Running</strong>: all of the containers have been created and the pod is bound to a node.</li><li><strong>Succeeded</strong>: the pod has terminated all containers with success.</li><li><strong>Failed</strong>: the pod has terminated and at least one container failed.</li><li><strong>Unknown</strong>: it was not possible to obtain the status of the pod.</li></ul><h3>Deployments</h3><p>Deployments are used to make updates on Pods. We can use them to bring up new Pods, change the image version of a container and even recreate the previous state if something goes wrong. When creating a Deployment we will define a desired state and Kubernetes will keep our environment in that desired state.</p><p>Imagine that we want to make sure we always have 3 pods running our web server. This is achievable by creating a Deployment that defines the replicas property as 3. What Kubernetes does when it runs this Deployment is to create 3 Pods with the given configuration of our web server. If for some reason one of the pods is destroyed Kubernetes will automatically bring up a new one. This will make our desired state of 3 replicas be achieved even when some problem occur.</p><p>We can monitor the status of our deployment to see if everything is going according to what is expected. When looking a Deployment status, the following information is available:</p><ul><li><strong>Desired</strong>: how many pods were defined in the desired state. When the deployment is finished the number of current pods should be equal to this column.</li><li><strong>Current</strong>: indicates the total replicas the Deployment manages.</li><li><strong>Up-to-date</strong>: how many pods have the latest template. For instance, if we change the container’s image version and run the Deployment again, a pod will only be considered up-to-date when the deployment finishes.</li><li><strong>Available</strong>: how many pods are in the Ready status.</li></ul><h3>Services</h3><p>Imagine that we have two services: ServiceA and ServiceB. ServiceA needs to communicate with ServiceB. Since Pods are ephemeral we cannot use them to be the ServiceB interface. If a Pod ends up being terminated the reference to it is no longer valid and the environment will not work properly anymore. We need something that is able to act as an interface and that will not be destroyed. In Kubernetes we achieve this using Services.</p><p>A Kubernetes Service consist of a set of Pods and a policy that defines the access control. Services can have label selectors, which are commonly used to invoke actions over the right subset of pods. We can think of them as a tag in AWS EC2, which allows us to select a set of instances based on the given information.</p><p>When publishing Kubernetes Services we can define how they are going to be exposed. For instance, a backend service usually is going to be accessible inside the local network, while a frontend service needs to be available outside the cluster. The possible types of Service we can define are listed bellow:</p><ul><li><strong>ClusterIP</strong>: the service is going to be exposed inside the cluster, with a local IP, and will not be reachable outside the cluster. This is the default option.</li><li><strong>NodePort</strong>: exposes the service on the given port, using the node IP. For instance, if the Node runs on 10.0.15.5 and the NodePort is 4567, we can reach the service on 10.0.15.5:4567.</li><li><strong>LoadBalancer</strong>: exposes the service using a cloud provider’s load balancer.</li><li><strong>ExternalName</strong>: the service is going to be exposed using the name configured on this property (e.g. mydomain.com).</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf47b0af1865" width="1" height="1" alt=""><hr><p><a href="https://medium.com/just-another-dev-blog/kubernetes-an-overview-bf47b0af1865">Kubernetes — an overview</a> was originally published in <a href="https://medium.com/just-another-dev-blog">Just Another Dev Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS EC2 Container Service — an overview]]></title>
            <link>https://medium.com/just-another-dev-blog/aws-ec2-container-service-an-overview-4b1460aeaf21?source=rss-11f074faffa------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b1460aeaf21</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-ecs]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Daniel Pereira]]></dc:creator>
            <pubDate>Sat, 18 Feb 2017 20:04:45 GMT</pubDate>
            <atom:updated>2017-02-18T20:04:45.189Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*3fqUKBLkXK4pmb3gVgrv8Q.png" /></figure><p>Amazon EC2 Container Service (ECS) is a container management service used to make it easier to install and operate Docker containers on AWS. It is designed to be highly scalable and to have high performance as well. As other services provided by Amazon, such as RDS, ECS handles fault-tolerance by itself, which means we don’t have to worry about that when designing our infrastructure using ECS.</p><h3>Clusters</h3><p>Clusters are a group of containers instances. ECS will create a default cluster when we run it for the first time, to make sure we have an environment to get up and running quickly. A cluster can have many container instance types, which means that we can perform different tasks inside the same cluster. An account can have many clusters at the same time, but a container can only be part of one cluster at a time.</p><p>As happens with other AWS services, a cluster belongs to a specific region. When creating a new cluster we must configure the following properties:</p><ul><li><strong>EC2 instance type:</strong> what instance should be used inside the cluster. This will affect how many tasks we can run inside the cluster.</li><li><strong>Number of instances:</strong> how many instances should be launched. The instance is launched using the ECS AMI.</li><li><strong>EBS Storage:</strong> the amount of GiB we want to launch our instance.</li><li><strong>Key pair:</strong> the key pair to access to connect via SSH. It can be left empty, but this will make the instance inaccessible from SSH in the future.</li><li><strong>Networking:</strong> the VPC we want to launch our cluster. By default, a VPC with two subnets in different AZs is created.</li></ul><h3>Containers Instances</h3><p>Containers Instances are EC2 instances that run the ECS agent and are registered into a cluster. They should have a proper IAM role with the required permissions since they make calls to the ECS service.</p><p>Instances should not be “transferred” between clusters: if we want to register an instance into another cluster it is recommended that we terminate the current instance and create a new one. This is important because the container instances stores unique information between the instance and the ECS. The same applies when trying to change the container instance type: the right way to do it is also terminate the current container and launch a new one.</p><p>When ECS register an instance to a cluster it will update the status to ACTIVE and the agent connection status to TRUE. This will make the container instance available to run tasks sent by ECS. Stopping a container will update the agent connection status to FALSE, which will make the container stop running tasks. Deregistering a container instance will change the status to INACTIVE. This change will not report the container anymore when listing container instances.</p><h3>Task Definitions</h3><p>A task definition, as the name implies, defines the tasks that run inside the container. Task definitions are required to run Docker containers inside ECS. The following parameters are the most common when configuring a task definition:</p><ul><li>The docker image to be used when running the container.</li><li>The CPU and memory usage limits.</li><li>The ports mapped from the container to the instance.</li><li>The command the container should run when started.</li><li>The environment variable to passe to the container.</li><li>The volumes that should be passed to the container.</li></ul><p>The parameters above represent what we usually pass to Docker when running a new container. One of the main goals of a task definition is to not repeat ourselves when launching new instances. Instead of having to configure a script with the desired parameters, or to copy and paste it in the console to launch another container, we have a task definition that knows how to launch new containers with the desired configuration.</p><p>These are not the only configurable parameter on a task definition. We can configure AWS specific features, like AMI roles, and so on. A list of all parameters can be found <a href="http://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html">here</a>.</p><h3><strong>Services</strong></h3><p>An ECS service allows us to maintain a number of instances of a task definition inside a cluster. A service is important to mantain the desired number of instances running: if a task fails or stop for any reason the service scheduler will launch another instance as a replacement, mantaining the same number of instances active.</p><p>When launching new tasks, a service will try to balance them across Availability Zones. The balancing strategy consider the following criteria:</p><ul><li>Determine which of the container instances can support the task definition. The service will look if the container instance have enough CPU, memory, available ports and so on.</li><li>With the containers instances filtered by the previous step, the EC2 Service sorts them from the least used AZs to the most used one. The AZ with fewer containers has priority over the other ones.</li><li>After figuring out the best AZ the EC2 Service will then place the task in the optimal place, considering both the AZ and the container instances regarding running tasks (the fewer the better).</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b1460aeaf21" width="1" height="1" alt=""><hr><p><a href="https://medium.com/just-another-dev-blog/aws-ec2-container-service-an-overview-4b1460aeaf21">AWS EC2 Container Service — an overview</a> was originally published in <a href="https://medium.com/just-another-dev-blog">Just Another Dev Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Certified Solutions Architect — Direct Connect, CloudFront and Route 53]]></title>
            <link>https://medium.com/just-another-dev-blog/aws-certified-solutions-architect-direct-connect-cloudfront-and-route-53-d33aa8210c72?source=rss-11f074faffa------2</link>
            <guid isPermaLink="false">https://medium.com/p/d33aa8210c72</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Daniel Pereira]]></dc:creator>
            <pubDate>Thu, 09 Feb 2017 02:26:28 GMT</pubDate>
            <atom:updated>2017-02-09T02:26:28.347Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*NuRF_hLSfhQ3jLf5jo7FQA.png" /></figure><h3>Direct Connect</h3><p>Some companies might need to transfer data from their data centers to AWS. Using a normal internet connection can raise some problems:</p><ul><li>Internet-based connections might be inconsistent over time: there is no guarantee that data transferred from point A to point B will not change the routing. Real-time applications might not behave as expected in such environment.</li><li>High latency: Send data over the internet might lead to a higher latency, depending on how many hops the data have to go over to reach the final destination.</li><li>When large data sets need to be transferred to the cloud companies will have to use the bandwidth that the rest of the company is using to perform other tasks. Beyond having the bandwidth of other areas of the company compromised, sometimes the current internet contract bandwidth is not going to be enough and will require a new contract to be negotiated. These contracts usually have a minimum commitment and will be more expensive that what the company is already paying.</li></ul><p>To solve this problem Amazon provides Direct Connect, a service that let us establish a dedicated network connection from our premises to AWS.</p><p>When using Direct Connect we pay for data transferred over the dedicated connection on-demand. This data is charged at the Direct Connect transfer rate, which is cheaper than the Internet data transfer rates. Another advantage of using Direct Connect is the data’s routing will not change, ensuring a more stable connection and low latency numbers over time.</p><p>To use Direct Connect we must create a virtual interface. There are two types of virtual interfaces:</p><ul><li><strong>Private Virtual Interfaces</strong>: are used to connect with internal IP addresses inside AWS EC2. It is a dedicated private connection which works like a VPN</li><li><strong>Public Virtual Interfaces</strong>: used to connect with AWS public endpoints, such as S3. It requires a public CIDR block range.</li></ul><h3>CloudFront</h3><p>CloudFront is a global CDN service that allows us to accelerate the delivery of web assets. This is possible because CloudFront sends the content from the origin to the user’s nearest edge location, reducing the latency of the request.</p><p>An origin can be an S3 bucket or an Elastic Load Balancer (ELB). Since the ELB DNS name is not that easy to remember we can integrate CloudFront with Route53, allowing the company to deliver content in a URL such as <a href="http://cdn.mycompany.com/">http://cdn.mycompany.com</a>.</p><p>CloudFront is designed for caching. When a user requests data and there is no cache on the nearest edge location to be retrieved, CloudFront goes to the origin, retrieves the data and store it into the cache. The data will be available until the cache expires, which means that new requests made from users whose nearest edge location is that one will always return the cached file.</p><p>Caching objects for longer periods of time increases performance since the origin will be free to perform other tasks. We must be careful, though: put a new version of a cached object will require us to invalidate the current cache. Invalidations are charged by Amazon and can be quite expensive if we want to invalidate too many objects. In such situations, it might be better to create a new distribution and change the DNS on Route53 to the new location.</p><h3>Route 53</h3><p>Route 53 is a DNS provided by AWS to be high available and scalable. It allows developers to:</p><ul><li><strong>Register domain names</strong>: allow us to register a name to a website, such as mycompany.com. <a href="http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/registrar-tld-list.html">The available domains are listed here</a>.</li><li><strong>Route internet traffic to the resources for your domain</strong>: allow users to get our content when the domain we registered is open on the internet.</li><li><strong>Check the health of our resources</strong>: sends automated requests to guarantee that a resource is still up and available.</li></ul><p>After we have a domain registered, we will create a hosted zone. A hosted zone is a container that holds information about routing traffic to the domain and its subdomains. Inside the hosted zone we’ll create many Record Sets. Record Sets have the following properties:</p><ul><li><strong>Name</strong>: the subdomain name we want to configure. If we leave it blank it will configure the domain name. (e.g. leave it blank, which considers mycompany.com)</li><li><strong>Type</strong>: the type of our record set. <a href="http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ResourceRecordTypes.html">The full list can be found here</a>. (e.g. A — IPv4 address)</li><li><strong>TTL</strong>: how long a record set is cached by DNS resolvers. (e.g. 1 minute)<br>Value: the value the name will be translated. It is based on the type selected. (e.g. 192.0.2.235)</li><li><strong>Routing Policy</strong>: which routing policy should be use to this record set. (e.g. Simple)</li></ul><p>When choosing the TTL value it is important to notice that higher values will make future changes take longer to propagate. Choosing the right routing policy it’s important as well. The following Routing policies are available:</p><ul><li><strong>Simple</strong>: as the name suggests it will make a simple route to the value informed on the record set.</li><li><strong>Weighted</strong>: It will send requests to the record set based on the given weight. A weight can have a value between 1 and 100. The higher the weight the higher the probability to be routed to that record set. Two record sets with the same name, defined with a weighted routing policy of 70/30 will receive 70% and 30% of the requests, respectively. It can be used as a failover solution as well. In this case, we can put the weights as 100/0. If Route 53 cannot deem the record set with weight 100 healthy it will automatically send the requests to the one with weight 0.</li><li><strong>Latency</strong>: goes to the region with less latency available. It also can behave as a failover solution when the other record sets aren’t healthy.</li><li><strong>Failover</strong>: used as a failover. We can define the primary and secondary record sets. If the primary is not responding anymore the traffic is routed to the secondary.</li><li><strong>Geolocation</strong>: ensures the request that comes from a specific location is routed to the correct place. This makes possible to be in compliance with laws that requires the content don’t leave a specific region, being the European Union an example of it.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d33aa8210c72" width="1" height="1" alt=""><hr><p><a href="https://medium.com/just-another-dev-blog/aws-certified-solutions-architect-direct-connect-cloudfront-and-route-53-d33aa8210c72">AWS Certified Solutions Architect — Direct Connect, CloudFront and Route 53</a> was originally published in <a href="https://medium.com/just-another-dev-blog">Just Another Dev Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Certified Solutions Architect — VPC]]></title>
            <link>https://medium.com/just-another-dev-blog/aws-certified-solutions-architect-vpc-f9264de2eaa9?source=rss-11f074faffa------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9264de2eaa9</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Daniel Pereira]]></dc:creator>
            <pubDate>Thu, 09 Feb 2017 02:26:16 GMT</pubDate>
            <atom:updated>2017-02-09T02:26:16.208Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*ruhOM7z9CiyGuafSkz4ETA.png" /></figure><p>Amazon Virtual Private Cloud (VPC) allows us to define our virtual network inside the cloud.</p><p>To properly use EC2 instances we must have a VPC configured. AWS already comes with one by default, allowing users to launch an EC2 instance without having to configure anything else. It comes with internet access enabled, which makes possible to update and install applications on the instance. Although the default VPC comes in handy and works just fine it is highly recommended to build our own from scratch when we are in a production environment. The following sections detail the components used on a VPC.</p><h3>Subnets and route tables</h3><p>A subnet is a range of IPs inside the VPC, configured using an IPv4 CIDR block. Each subnet must be associated with a route table. A subnet can have only one route table, but we can add the same route table for as many subnets as we want. Every route table has a local route, which cannot be deleted. The local route is used for communication within the VPC.</p><p>A subnet must belong to a specific Availability Zone (AZ). Each subnet can have only one AZ and it’s recommended to create more than one subnet in different AZs to avoid a single point of failure in a production environment.<br>A subnet can also be considered private or public. What determines its “visibility” is whether it has an Internet Gateway attached or not: if it has it is considered public, otherwise, it is private. As happens with route table, each subnet can have only one Internet Gateway attached to it. We should use private subnets to host instances that do not need to communicate with the internet, improving the security of our environment.</p><h3>NAT Instances and NAT Gateway</h3><p>EC2 instances running inside private subnets might have to access the internet in some specific cases. Imagine that we have to update the software inside our instance: although it shouldn’t be accessible from the internet (receive inbound traffic), we still want to allow the instance to get the latest versions available on the web (send outbound traffic). The problem is that we don’t have an Internet Gateway attached to our route table. which means that our subnet won’t recognize an IP from outside our VPC. The solution to this problem is to use a NAT device.</p><p>A NAT device will forward the traffic on the private subnet and send the response back. Attaching a NAT device on the route table instead of an Internet Gateway allows the subnet to remain private, which means that it still won’t be accessible from the internet. There are two types of NAT device that can be used on AWS right now. NAT instances and NAT gateways.<br>A NAT instance is an EC2 instance with a specific AWS AMI running on it. We can choose any instance type and size, but they will affect the availability and bandwidth: we can use a t2.nano to serve as our NAT and it will work, but it will result in a very slow connection with the internet, especially if we have many instances making requests at the same time.</p><p>Having an EC2 instance to run a database were very common, which made AWS launch RDS. The same thing happened to NAT instances: since many people used this feature, AWS launched a specific service to accomplished that, which is called NAT Gateway. A NAT Gateway, just like RDS, will take away responsibilities from us: Amazon guarantees the availability for us. A NAT Gateway can burst up to 10 Gbps of bandwidth, which is usually enough to maintain a subnet properly working. AWS recommends the use of NAT Gateways over NAT instances. <a href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-comparison.html">They offer a comparison between them if you want further details</a>.</p><h3>Security Groups</h3><p>Security Groups are used as a firewall in front of an EC2 instance. They are used to define what kind of traffic is allowed inside our instance as well as the source of the traffic. An instance can have multiple security groups, limited to 5 per instance. It only supports allow rules, which means that anything that is not explicitly defined as an allow will have the access denied. Security Groups are also stateful: if a request is allowed to come in it will be allowed go out and vice-versa.</p><p>When creating a new Security Group all outbound traffic is allowed by default, but we can change it to be more restrictive. We can choose which ports or range of ports will be allowed, as well as the source of the traffic. The source of the traffic will be an IP or another Security Group. If the source is another Security Group any component that has the given Security Group attached can send requests in the ports that were specified.</p><h3>Network ACLs</h3><p>Network Access Control List (ACL) is an optional layer of security that operates at the subnet level, which means that traffic blocked on ACL will never reach the instances. Unlike Security Groups, that only support allows rules, ACLs supports both deny and allow rules. Another difference when comparing them with Security Group is that they are stateless: if we have a rule allowing something to go inbounds we must have a rule allowing the traffic to go outbounds as well. If we don’t have both rules available the traffic cannot leave our subnet.</p><p>ACL rules are processed in ascending order: each rule will have a unique number and the lowest number that matches the traffic sent will be executed. This allows us to defined a rule that behaves like an exception when specific cases apply.</p><p>A common use of this feature is to block access from an IP that is making malicious requests to the subnet. In this scenario, we would define an allow rule that would be valid for everyone (In CIDR notation this is expressed as 0.0.0.0/0) and put an asterisk as the role number. An asterisk makes it the default option that will be executed when no other rule was matched.</p><p>After that, we specify a deny rule to an IP that is causing us trouble and give it a number to identify the rule execution priority. From now on requests made from that IP will match the deny rule first, which will block them from entering the subnet. All other IPs will execute the default rule that allows traffic to go into the subnet.</p><p>A good practice when defining the number of the rule is to leave a gap between each of the rules. This makes the infrastructure easier to maintain when we have to add a rule that has to execute between two rules that already exist. In a scenario where rules A and B are defined as 1 and 2, we cannot add rule C in the middle of them, we would need to change the priority of all of them to make it work properly. If rule A was defined as priority 10 and rule B as priority 20 we could add rule C as any number between 11 and 19 without changing anything we have done previously.</p><h3>VPC Peering</h3><p>When designing a production environment we often have to communicate between different VPCs. A company that has different AWS accounts for each team is a classic example: on of the teams needs to access an EC2 instance of the other team, but the machine is located on a private subnet and can only be accessed through the VPC. To make this communication happen we need to set up a VPC Peering.</p><p>A VPC peering creates a direct connect between two VPCs. The VPCs don’t need to be on the same account, but they cannot have a conflict in CIDR block ranges since it would not be possible to distinguish to which subnet a request with a conflicted IP must be sent. Another thing to keep in mind is that only VPCs inside the same region can peer.</p><p>VPC Peering is not transitive. Imagine we have three VPCs: A, B, and C. If we peer A with B and B with C can we access EC2 instances from VPC C on VPC A or vice-versa? The answer is no, the only way that two VPCs can communicate is if they are explicitly connected.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9264de2eaa9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/just-another-dev-blog/aws-certified-solutions-architect-vpc-f9264de2eaa9">AWS Certified Solutions Architect — VPC</a> was originally published in <a href="https://medium.com/just-another-dev-blog">Just Another Dev Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Certified Solutions Architect — RDS]]></title>
            <link>https://medium.com/just-another-dev-blog/aws-certified-solutions-architect-rds-b9870beb6374?source=rss-11f074faffa------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9870beb6374</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Daniel Pereira]]></dc:creator>
            <pubDate>Thu, 09 Feb 2017 02:26:04 GMT</pubDate>
            <atom:updated>2017-02-09T02:26:04.043Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*wq1TigE5Zk8-3NExrXVLDg.png" /></figure><p>The AWS Relational Database Service, best known as RDS, is a service made to operate and scale relational databases in the cloud.</p><p>As we saw in the last post an EC2 instance is a virtual machine on the cloud and can host any application the user wants to. When we’re thinking about databases on the cloud why don’t we just run an EC2 instance with the desired database on it? Although the idea is valid and can be applied, it has some caveats:</p><ul><li>We have to manually update the database. This is valid for both minor and major updates.</li><li>We are responsible for the Operation System running into the instance. Security updates, as well as other configurations needed, will be performed by us.</li><li>Backups also have to be manually created, which will cause additional effort to automate.</li><li>To avoid a single point of failure it’s necessary to configure and ELB and more than one instance on a target group, which means extra cost.</li></ul><p>Since running a database instance is something most applications on the cloud have to do, Amazon decided to launch a specific service to handle this, this service being RDS. RDS provides a database instance abstracting the Operation System running it, making it easier to administrate. We also can choose to run our instance in a Multi-AZ deployment, which will perform the failover automatically, without having to create and manage an ELB. With RDS we can run most of the popular databases in an easier way than presented by an EC2 instance. The current supported databases are:</p><ul><li>MySQL</li><li>PostgreSQL</li><li>Oracle</li><li>Microsoft SQL Server</li><li>Aurora</li><li>MariaDB</li></ul><p>RDS instances use Security Groups from VPC, which means we have to explicit tell which ports will be open to users connect. Ports that aren’t specified will have traffic denied. The data storage types are also the same from EC2. We can have General Purpose SSD, which will have burstable performance and can accumulate up to 3000 IOPS. If we want to secure the number of IOPS available we can pick Provisioned IOPS SSD. For simple tests and development environment we can decide to use a Magnetic storage.</p><p>Instances can have a minimum of 5 GiB and can be as large as 3 TiB. We can store daily backups, going from 0 days up to 35 days of retention. As happens with EC2, we only pay for the difference between the snapshot taken and the previous version, which reduces costs to store backups for several days. One important thing to notice is that backups taken against the production instance might lead to I/O freezes and slow down the service. Another important thing to notice is that backups are removed with the RDS instance. If you want to keep data from the RDS is necessary to take a manual snapshot from the instance.</p><p>To avoid I/O freezes we can use a read replica. A read replica is an instance that can only be used to access data. They are supported on MySQL(InnoDB only), PostgreSQL and Aurora. On MySQL and PostgreSQL it uses the native database replication. They help to avoid I/O freezes by being the ones who RDS takes the snapshot from. Taking a snapshot from the read replica means that our master instance we’ll have a decrease in data requested, which will slow down the freezes.</p><p>What happens if we want to change database configurations? Since we don’t have access to the Operational System we need to have another method of getting into the database properties. This is made through Parameter Groups. They contain the configuration values we want to apply on the instance we’re running. Not specifying a parameter group will make RDS create their own. The default RDS parameter group will contain the default properties values of the respective database.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9870beb6374" width="1" height="1" alt=""><hr><p><a href="https://medium.com/just-another-dev-blog/aws-certified-solutions-architect-rds-b9870beb6374">AWS Certified Solutions Architect — RDS</a> was originally published in <a href="https://medium.com/just-another-dev-blog">Just Another Dev Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Certified Solutions Architect — EC2]]></title>
            <link>https://medium.com/just-another-dev-blog/aws-certified-solutions-architect-ec2-70656b376767?source=rss-11f074faffa------2</link>
            <guid isPermaLink="false">https://medium.com/p/70656b376767</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Daniel Pereira]]></dc:creator>
            <pubDate>Thu, 09 Feb 2017 02:25:29 GMT</pubDate>
            <atom:updated>2017-02-09T02:25:29.620Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/424/1*p105PIzBEt4Nc0Mm41HHiA.png" /></figure><p>Amazon Elastic Compute Cloud (EC2) provides scalable computing capacity in the cloud. EC2 is one of the most used services inside AWS, enabling its users to eliminate the upfront cost that comes in acquiring hardware. Running virtual environments, known as instances inside of EC2, is the equivalent of having an actual hardware, with the advantage of scaling in and out with just a few changes on AWS.</p><h3>Instances</h3><p>Instances are the core of EC2. They are virtual environments that run an operating system and behave like any computer we know. Instances can be in three different states:</p><ul><li><strong>Running</strong>: when an instance is active and can be accessed per defined policies</li><li><strong>Stopped</strong>: the equivalent of having your computer turned off. The instance is still there, but we cannot access until we start it again.</li><li><strong>Terminated</strong>: the instance was removed from EC2 and cannot be accessed anymore</li></ul><p>We only have costs when an instance is running. This means that if we stopped an instance we don’t pay anything until we decided to start it again. It is important to notice that the volume associated with the instance will be charged normally, though.</p><p>We can assign a public IP to an instance to make it available on the internet. If we choose this option from the EC2 launch wizard it will work just fine, but be careful: if we reboot or stop or instance there is no guarantee that the public IP will remain the same. Actually, the chance of getting a different public IP when the instance starts again is very high. If we need to have a fixed public IP we need to allocate an Elastic IP. An Elastic IP is a public IP address that will remain with us until we release it and can be allocated to be used on an EC2 instance. In this case, even if the machine is stopped, reboot or even terminated we still maintain the public IP address on our control.</p><h4>Types of instance</h4><p>Instances can have different computational power. If we want to run a small application that is going to be used only for a few people it seems more logical to buy an instance that doesn’t have many vCPU or GBs of memory available, since it would be overkill. The same applies to a bigger application, that it is used for lots of people: we expect a powerful machine to handle this kind of situation.</p><p>AWS has different instances to different use cases. There are five different families of instances available, each one optimized for a specific case:</p><ul><li><strong>General Purpose</strong>: instances that provide a good balance between CPU performance, memory, and network resources.</li><li><strong>Compute Optimized</strong>: instances with the lowest price/compute performance ratio.</li><li><strong>Memory Optimized</strong>: instances with the lower price per GB</li><li><strong>Accelerated Computing Instances</strong>: instances optimized for graphics-intensive applications</li><li><strong>Storage Optimized</strong>: instances that deliver a higher I/O performance</li></ul><p>Each family has many types of instances to choose. Types will basically differ from each other based on the hardware they run. Besides hardware difference, there is the T2 type, which is a type of instance that it’s called burstable. T2 belongs to the General Purpose family and will accumulate CPU power if it is on idle, which can be used later if it is needed. This is an ideal scenario for applications that have usage peaks in some period of the day and are not frequently accessed in others. Using a T2 instance allows the application to burst performance when needed, reducing the cost of having to launch another instance for these specific periods of time.</p><h4>Payment options</h4><p>Instances have some big advantages when compared to buying hardware: we only pay for what we actually use, we don’t have to worry about buying instances days or months in advance since everything we need to launch a new instance is some clicks. We don’t have to worry about the costs of hardware maintenance as well.</p><p>Despite looking a very optimized way of reducing costs already, we can reduce it even further inside AWS. Choosing the right type of payment can have a big impact on the final cost, so knowing the options and when to use them becomes very important. AWS has three types of instances that can be bought: on-demand, reserved and supported instances.</p><p>On-demand instances are the default option when going into EC2. As the name suggest they are charged on-demand: if we’re using the machine we are paying for it, otherwise, we are free of charge. The big advantage that on-demand instances bring is that we don’t have any ties with Amazon. If we decide to buy or own hardware and move from there we can do it right away. Since this model is the one which gives more freedom, this is also the model with the more expensive price.</p><p>What happens if the company decides that AWS is the place to host their applications for a long time? In this case, it is possible to use reserved instances. Reserved instances guarantee that we’ll have it available for the chosen period of time. As of today, we can choose to reserve an instance for one or three years. We also can choose how much money we want to put up in front. The more the money we pay right away the cheaper the instance becomes. It is possible to get up to 60% of discount in this model, so when we’re planning to stick with AWS for some time this option becomes very attractive.</p><p>Buying reserved instances also guarantee higher priority: if AWS runs out of an instance type, who already reserved it will have it guaranteed, while those who chose on-demand will be left behind. Although we cannot change the type of instance we are allowed to change its sub-type: if we reserved a t2.medium we can change it to a t2.large, but we cannot change it to an m4.large. What happens if we want to change the instance type or we don’t want or reserved instance anymore? We can sell it on AWS. The instance will be available to be bought and as soon as someone buys it we don’t have to pay it anymore.</p><p>The last model of payment is spot instances. They allow us to bid on spare compute cloud time. They are very cheap instances compared to the on-demand model and are a very good option to run processes that can be interrupted. This type of instance should never run in a production environment since Amazon can take it back anytime they want to. This will happen when the computational power that was unused starts to be used again.</p><h3>Storage</h3><p>Just like in a computer we have at home EC2 instances have a disk to store data. These disks are called volumes inside AWS and are available in two different options: root volumes and Elastic Block Store (EBS) volumes. Root volumes are an EBS volume like the other ones, but they are used to run the operating system on the EC2 instance. They can have other configurations along with the OS, but they cannot be encrypted, which means that sensitive data you want to protect to be compliance with shouldn’t be placed on them. Root volumes are build from an Amazon Machine Image (AMI), which contains the software configuration that the user wants to run.</p><h4>Elastic Block Store</h4><p>EBS Volumes provides persistent data block storage volumes. To improve durability, an EBS volume will be replicated through the availability zones of the region. EBS volumes outlive the instance they were created, which means we can attach it to another EC2 instance after having the original terminated. It is important to notice that we cannot attach the same EBS volume in two instances at the same time. On the other hand, it is possible to have many volumes attached to one instance. EBS volumes are created in a specific availability zone and can only be attached to an EC2 that is in there as well.</p><p>EBS are measured by IOPS, the input/operations per second that go through the disk. Each IOP is 256 KB or smaller. If an operation greater than 256 KB is sent to the disk it will be divided in more than one IOP. For instance, if a 512 KB read is performed, two IOPS are counted in that second. EBS volumes can be created in three different types:</p><ul><li><strong>General Purpose SSD</strong>: this option provides an SSD to store our data. It is usually used on dev/test or applications that don’t have a big amount of disk usage. As happens to the EC2 t2 instance, the General Purpose SSD has burstable performance: if we don’t use all of our IOPS in a second it will accumulate to be used later. The IOPS can accumulate up to 3000. Each GB of disk will grant us 3 IOPS, with the minimum of IOPS-guaranteed to be 100. This SSD has a minimum size of 4 GiB and a maximum size of 16 TiB</li><li><strong>Provisioned IOPS SSD</strong>: this option also provides an SSD to store data. The difference between this and the General Purpose SSD is the burstable performance. When choosing Provisioned IOPS we reserve a number of IOPS and pay for it, but they’ll be guaranteed regardless of disk size. This means we can have a 100 GiB disk and acquire 1000 IOPS at the same time. The main use of this option is when we know that our application will load or write big amounts of data and we want to ensure we have the right performance. The minimum and maximum size are the same as the General Purpose SSD: 4 GiB and 16 TiB, respectively.</li><li><strong>Magnetic</strong>: option that allows us to reduce costs. Should be used when performance it’s not important or when data is rarely requested. Since it is an option that usually doesn’t meet the requirements of a production environment the max size of the disk is limited as well: the minimum size of the disk is 1 GiB and it only allows us to create a 1 TiB disk at most.</li></ul><h4>Snapshots</h4><p>To increase data durability we can take snapshots of our EBS volumes. They can serve as a backup, allowing to reverse some change that breaks our system. They can also be used to create AMIs of customized data, making it easier to configure instances with all requirements that the company needs to fulfill. For instance, we can run a basic Amazon Linux AMI, install and configure our applications, take a snapshot and make an AMI from it. The next time we need to launch an instance to run our application we can just select the AMI we just created and everything will be configured when the instances launch.</p><p>Snapshots are stored in S3, which means they are very durable. We cannot access it using our S3 account, though. If we take a snapshot it will only be available through EC2 Snapshots, none of our buckets will be used to store them, only Amazon have access to it. Another important aspect of Snapshots is that we only pay for the data one time. The first snapshot will store all the data inside the disk and the following ones will only store the difference between them and the previous one. If we take 10 snapshots without any change we’ll pay only for the price of the first one. It is important to notice that snapshots degrade the instance performance and should be taken in non-peak periods of time.</p><h3>Elastic Load Balancer</h3><p>The Amazon Elastic Load Balancer is used to balance traffic across EC2 instances, aiming for high availability and fault tolerance. We can use them as public load balancers, that will be reachable on the internet, as well as internal load balances, which will be only used inside our network. <br>When creating a load balancer we choose the ports that it will listen to. All incoming from these ports will be passed to the target group. We also have to choose at least two subnets, so if something happens with one of the AZ we still can route the traffic to the other one.</p><p>A target group is a group os EC2 instances that will receive the request from the load balancer. We define in which port the request should be received and then we pass it to one of the instances. When defining the target group we must choose a port and a path to AWS perform a health check. A health check pings the given path/port. If it receives a response the instance is considered healthy, otherwise, the instance will be removed from the ELB. The options regarding health check are:</p><ul><li><strong>Healthy threshold</strong>: how many times a request has to succeed before the instance is considered healthy</li><li><strong>Unhealthy threshold</strong>: how many times a request has to fail before the instance is considered unhealthy</li><li><strong>Timeout</strong>: how many seconds should the ELB wait for the response<br>Interval: how many seconds should be between requests</li><li><strong>Success codes</strong>: the HTTP code which should be returned to a request be considered successful</li></ul><p>The ELB uses round-robin to send user requests to the target group. If a target group has 3 instances names instanceA, instanceB, instanceC, and receive four requests, the ELB will send them to instanceA, instanceB, instance and instanceA, respectively.</p><p>Amazon has two kinds of ELB available: Classic Load Balancer and Application Load Balancer. The Classic Load Balancer has all the features mentioned in this section. It was the original ELB and it is still available for use. The Application Load Balancer has the same functionalities than the Classic, and also allows making more complex decisions, such as Content-Based routing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70656b376767" width="1" height="1" alt=""><hr><p><a href="https://medium.com/just-another-dev-blog/aws-certified-solutions-architect-ec2-70656b376767">AWS Certified Solutions Architect — EC2</a> was originally published in <a href="https://medium.com/just-another-dev-blog">Just Another Dev Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Certified Solutions Architect — S3]]></title>
            <link>https://medium.com/just-another-dev-blog/aws-certified-solutions-architect-s3-5baa99021d4?source=rss-11f074faffa------2</link>
            <guid isPermaLink="false">https://medium.com/p/5baa99021d4</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Daniel Pereira]]></dc:creator>
            <pubDate>Thu, 09 Feb 2017 02:25:10 GMT</pubDate>
            <atom:updated>2017-02-09T02:25:10.653Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*Bbdx_ZjoHiUfjRaYha8xkQ.png" /></figure><p>Amazon Simple Storage Service, better known as S3, is a service on AWS to store data on the internet.</p><h3>Buckets</h3><p>Buckets are the containers to store data on S3. They can be viewed as a root “folder” responsible for store every object data that is uploaded. Buckets are useful to easily identify accounts storage usage, so we can properly charge users for what they are using.</p><p>Buckets are created in a specific region. This allows the architect building the infrastructure to choose the best place to store the data, based on where the users of the application are located. Choosing the right region can lead to a lower latency, improving the application performance as a result. Buckets that are in the same region of an EC2 instance are free of charge when transferring data.</p><p>Names are globally unique for each bucket. If someone creates a bucket called <em>mycompany</em> that name is not available to other AWS accounts anymore, even if the root AWS account or the region is different.</p><p>It is possible to host a static web page using a bucket. To make it happen we must store our web files on the bucket, make them public and enable the web-hosting on the bucket properties. After that we define our index page and the page that will be presented when an error happens (e.g. someone accessing a protected file without permission) and that’s it! We have our static website hosted on S3.</p><h3>Limitations</h3><p>Each AWS account can have 100 buckets by default. If more buckets are needed Amazon must be contacted in order to increase this number. Another thing to have in mind is that buckets cannot be transferred to another account. If the company wants to move a bucket to another account it will have to delete the original bucket and recreate it in the desired one.</p><p>There is no guarantee that the name will be available, though, because someone can create the bucket as soon as it is available. Another important thing to keep in mind is that a bucket deleted in on the region can be instantly recreated in the same region, but it might take up to an hour to recreate it on another region.</p><p>Although the total storage size is unlimited, an object stored on S3 has a max size of 5 TB. To upload files that have more than 100 MB Amazon recommends using Multipart upload, which breaks the data into parts. Breaking the object into parts allows the user to stop and resume the upload when necessary.</p><h3>Storage types</h3><p>There are three ways to store data on AWS that developers usually look into. Going from the most expensive to the cheapest they are: S3 Standard Storage, S3 Reduced Redundancy Storage and Amazon Glacier.</p><p>S3 Standard Storage, as the name implies, in the default option. It is designed to be highly durable, having 99.999999999% durability, also know as “eleven nines of durability”. It is also designed to be highly available, reaching 99.99% of availability. We should use this option to store important data, that we cannot lose and that aren’t easily reproducible.</p><p>S3 Reduced Redundancy Storage, also know as S3 RRS, is a cheaper version than S3 Standard Storage. It also has 99.99% availability, which means that we should be covered when trying to access the data. The main difference is the durability: it guarantees 99.99% of durability. In other words, we might lose data more often than we’d like. S3 RRS is a very good choice when dealing with data that is easily reproducible.</p><p>Amazon Glacier is the cheapest of them. It only costs USD 0.004/GB per month to store data on it. As the S3 storage types, Glacier is very durable, but it lacks availability. If we need to access data from there it might take many hours to retrieve the content. Files that the company wants to keep archived, as old logs or data that is not used for a long period of time, can be considered to be moved to Amazon Glacier.</p><h3>Lifecycle policies and versioning</h3><p>Sometimes data is not important after a period of time and we can move it to another place, or even remove it permanently. This can be done in S3 using lifecycles policies. To make it work we go into our bucket and add a rule in the lifecycle section.</p><p>We can choose if this rule is going to be applied to the whole bucket or to a certain prefix. Choosing a certain prefix allows that only a certain namespace inside our bucket behave in the way we specify. After that, we have to choose what will happen to the object (e.g. move it to Glacier, permanently delete) and how many days after the object creation the action should take effect. <br>More than a rule is needed? Not a problem, a bucket support many rules at the same time.</p><p>What if we need to keep track of the version of the objects? In this case, we could enable versioning. When versioning is active every time an object is replaced for a new one S3 creates a version inside the bucket and we have access to both versions. Besides the obvious version control advantage that it presents, this could be also used as a backup method since the versioning also keeps deleted objects on its track.</p><p>Another important thing to keep in mind is that S3 have eventual consistency is some scenarios. If we create a new object and try to access it right away from another availability zone Amazon can guarantee that the object will be there. This will cause a higher latency, though, since the operation needs to ensure all availability zones have been synced. When we make a PUT request to a file that already exists or a DELETE we might run into eventual consistency, which means that if we ask right away for that file the older version might be retrieved.</p><h3>Security</h3><p>All buckets and objects are private by default. This means that if we don’t have an AWS account with the proper authorization we won’t be able to access the data stored. Even if someone manages to get the URL to access the object they still won’t be able to get the data since S3 has signed URLs. Sometimes we want to share the content with another people without they have an AWS account. What can be done in this scenario?</p><p>S3 allows us to change files to be available to anonymous users. This is done by granting a permission to Everyone open or download the specific file. What happens if we want only our site to display the content? In this case, if someone on the internet copies the link and post on their own website it shouldn’t work. To make it happen we can change the CORS configuration of the bucket. From there we can define what HTTP methods are accepted, which origins are allowed. These changes will make sure only the sites which have permission will access the content from the bucket.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5baa99021d4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/just-another-dev-blog/aws-certified-solutions-architect-s3-5baa99021d4">AWS Certified Solutions Architect — S3</a> was originally published in <a href="https://medium.com/just-another-dev-blog">Just Another Dev Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Certified Solutions Architect — IAM]]></title>
            <link>https://medium.com/just-another-dev-blog/aws-certified-solutions-architect-iam-e920578e3cb6?source=rss-11f074faffa------2</link>
            <guid isPermaLink="false">https://medium.com/p/e920578e3cb6</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Daniel Pereira]]></dc:creator>
            <pubDate>Thu, 09 Feb 2017 02:21:07 GMT</pubDate>
            <atom:updated>2017-02-09T02:21:07.222Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*uzQpIDtV4Ct8BbZKyv1FOQ.png" /></figure><p>IAM, abbreviation to Identity &amp; Access Management, is the service used to create new accounts and manage authorization on AWS resources. It is considered a global service inside AWS, which means that changes made inside IAM will be available in all regions at the same time.</p><p>To manage what a user can or cannot do we declare a policy. In a policy we must define the following items:</p><ul><li><strong>Actions</strong>: the actions that will be considered in this policy. It can vary from a specific action on a specific service to all actions on all services.</li><li><strong>Resources</strong>: the resources where the actions defined take effect.</li><li><strong>Effect</strong>: what should happen when the criteria of this policy are matched. The available options are Deny/Allow.</li></ul><h3>Policies</h3><p>A policy is a document that defines permissions. Policies are written using the <a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html">Access Policy Language</a>. The policy below is an example that allows full access to all services from all resources:</p><pre>{<br>    &quot;Version&quot;: &quot;2012–10–17&quot;,<br>    &quot;Statement&quot;: [{<br>        &quot;Effect&quot;: &quot;Allow&quot;,<br>         &quot;Action&quot;: &quot;*&quot;,<br>         &quot;Resource&quot;: &quot;*&quot;<br>    }]<br>}</pre><p>As they are commonly used, AWS made default templates representing job functions in a company. Some useful templates are:</p><p>- <strong>AdministratorAccess</strong>: provides full access to all AWS services and resources<br>- <strong>PowerUserAccess</strong>: provides full access to all AWS services and resources, but does not allow management of Users and groups<br>- <strong>ViewOnlyAccess</strong>: provides read-only access to all AWS services.</p><p>AWS also provides default template policies for all of their services. For instance, if one of the users is only allowed to access EC2 there is a policy called <strong>AmazonEC2FullAccess</strong> that grants the required permissions.</p><p>When a policy is not defined the default behavior is to deny access to the resource. If we create a user with no policy attached he won’t be able to do anything. It is also important to note that an explicit deny will always override an explicit allow. If we have two policies attached to a user, one allowing access to a resource and one denying access to the same resource, the AWS will consider that the user doesn’t have access permission.</p><h3>Identities</h3><p>We must represent a person or a service on AWS in order to provide the proper authentication. This representation is made using identities. There are three kinds of identity that can be created: users, groups, and roles.</p><p>An IAM user is an entity that allows users to login into the AWS Management Console and make API calls. Each user will have a login and a password to access AWS Management Console, which must follow the password policy defined on IAM. The API calls are made using an access key. Each user can have two access keys at the same time.</p><p>An IAM group is a collection of IAM users. They are useful to manage permissions since a policy attached to the group is going to be attached to all users on the group as well. For instance, instead of attaching a policy that allows full access to EC2 for each developer, we can create a group named Developers, attach the policy to the group and add all the developers to this group.</p><p>An IAM role is used to define permissions on AWS services. The main difference between a role and a user when accessing an AWS service is that roles don’t have credentials, avoiding them to be exposed. If we want to access AWS resources from EC2 we can use credentials from an IAM user, but they will be stored on the EC2 instance, which is a bad security practice. Instead, we could create a role with the proper policies attached and add it on the EC2 instance. This will grant the right permissions without exposing any credentials.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e920578e3cb6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/just-another-dev-blog/aws-certified-solutions-architect-iam-e920578e3cb6">AWS Certified Solutions Architect — IAM</a> was originally published in <a href="https://medium.com/just-another-dev-blog">Just Another Dev Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Economia comportamental]]></title>
            <link>https://medium.com/devaneiosliterarios/economia-comportamental-943e8867bf70?source=rss-11f074faffa------2</link>
            <guid isPermaLink="false">https://medium.com/p/943e8867bf70</guid>
            <category><![CDATA[economia-comportamental]]></category>
            <category><![CDATA[economia]]></category>
            <category><![CDATA[dan-ariely]]></category>
            <dc:creator><![CDATA[Daniel Pereira]]></dc:creator>
            <pubDate>Thu, 29 Dec 2016 15:01:01 GMT</pubDate>
            <atom:updated>2016-12-30T13:18:42.751Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*U-EijzQr7VVRg3BL_O85Mw.jpeg" /></figure><p>Até os anos 80 os economistas consideravam que as pessoas agiam baseadas em decisões racionais: cada indivíduo toma suas decisões de maneira egoísta, comparando os custos e benefícios de cada opção disponível para decidir o que lhe traz melhor resultado. Esse conceito de racionalidade por trás de cada decisão tomada é conhecido por <em>Homo economicus </em>e é um dos pilares da grande maioria das teorias econômicas<em>.</em></p><p>Amos Tversky e Daniel Kahneman, dois psicólogos israelenses, questionaram a verdade desse conceito, afirmando que as pessoas podem tomar decisões irracionais que lhes prejudiquem ou que não sejam sua melhor opção. Essa área de estudo vem ganhando espaço e é conhecida como economia comportamental.</p><p>A dupla realizou experimentos buscando entender como o ser humano lida com questões econômicas, analisando também o aspecto psicológico por trás de cada ação. Um dos experimentos separou dois grupos de pessoas, que precisavam fazer uma decisão baseada nos seguintes cenários:</p><ul><li>“Você precisa comprar uma caneta de uma marca específica. O preço da caneta na loja onde você está é U$ 25,00, porém é possível ir até uma segunda loja e comprar ela por U$ 18,00. A distância a pé até a loja é 15 minutos. Em qual loja você compra a caneta?”</li><li>“Você está numa loja para comprar um terno. Ele custa U$ 455,00 na loja atual, mas um amigo seu lhe informa que se você andar 15 minutos vai achar uma loja onde ele custa $448,00. Em qual loja você compra o terno?”</li></ul><p>A maioria das pessoas que precisava comprar a caneta optou por andar 15 minutos até a outra loja, enquanto quem precisou comprar o terno resolveu comprar na loja atual. Uma decisão puramente racional levaria as pessoas a escolherem a mesma opção nos dois cenários, pois em ambos os casos a caminhada de 15 minutos economiza U$7,00. O que foi observado pelos psicólogos é que somos influenciados pelo preço total do item, mesmo que ele seja irrelevante no nosso ganho final, mostrando que o conceito do <em>Homo economicus </em>nem sempre é praticado no mundo real.</p><p>Outro nome importante para a evolução dos estudos da economia comportamental é Dan Ariely, psicólogo americano autor do livro <a href="https://www.amazon.com.br/Previsivelmente-Irracional-Dan-Ariely/dp/8535223711/ref=sr_1_1?ie=UTF8&amp;qid=1482974064&amp;sr=8-1">Previsivelmente Irracional</a>. Ariely afirma que o comportamento irracional é comum no nosso cotidiano, sendo ele nossa reação padrão ao encontrarmos certos cenários. Seu livro expõe situações onde o comportamento irracional faz as pessoas tomarem decisões premeditadas, mesmo quando elas acreditam estarem no controle da situação.</p><p>Uma das situações envolve a escolha entre duas opções que não apresentam um grau de comparação óbvio. Essa dificuldade permite que o comportamento humano seja manipulado para escolher uma opção específica. Para isso é adicionada uma terceira opção, facilmente comparável com uma das outras duas, porém inferior. Um dos estudos feitos para provar a teoria envolveu um anúncio do jornal The Economist. Ariely mostrou à 100 alunos do MIT as seguintes opções de inscrição para o jornal:</p><ul><li>Versão online: U$ 59,00</li><li>Versão impressa: U$ 125,00</li><li>Versões online e impressa: U$ 125,00</li></ul><p>Ao serem indagados a escolher uma opção 16% dos alunos optaram pela versão online, 0% optou pela versão impressa e 84% optou pela versão online e impressa. Neste primeiro levantamento é clara a preferência pela versão online e impressa pelos entrevistados. Após obter os resultados, a versão impressa foi removida das escolhas possíveis e 100 novos alunos foram abordados. Neste novo grupo 68% escolheu a versão online, sendo que os 32% restantes escolheram a versão online e impressa.</p><p>O experimento demonstra que uma opção aparentemente inútil foi determinante na escolha de grande parte das pessoas entrevistadas. Ariely afirma que a facilidade dos estudantes perceberem a vantagem de uma opção sobre a outra a torna a mais atrativa de todas, incluindo a opção cuja comparação é mais complexa.</p><p>O estudo da economia comportamental é relativamente recente, porém já tem um impacto alto na economia atual. Várias empresas adotam estratégias de preço e opções de produtos baseados em suas teorias, sendo que a tendência é termos cada vez mais empresas olhando este lado da psicologia que está presente dentro da economia.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=943e8867bf70" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devaneiosliterarios/economia-comportamental-943e8867bf70">Economia comportamental</a> was originally published in <a href="https://medium.com/devaneiosliterarios">Devaneios Literários</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Curva de Laffer]]></title>
            <link>https://medium.com/devaneiosliterarios/curva-de-laffer-3ed14465116d?source=rss-11f074faffa------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ed14465116d</guid>
            <category><![CDATA[economia]]></category>
            <category><![CDATA[governo]]></category>
            <category><![CDATA[curva-de-laffer]]></category>
            <category><![CDATA[impostos]]></category>
            <dc:creator><![CDATA[Daniel Pereira]]></dc:creator>
            <pubDate>Wed, 05 Oct 2016 22:31:01 GMT</pubDate>
            <atom:updated>2016-10-05T22:31:01.096Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*7UhJsOTyDM_7nGXiAGj00w.png" /></figure><p>O tamanho e influência de um governo sobre um país é um tema que gera grande polêmica. Há quem defenda um governo com intervenção mínima na economia e há quem acredite que o governo deve participar de forma mais ativa. Seja qual for a opinião, existe uma verdade difícil de questionar: o governo precisa de receita para existir. Como o governo faz para adquirir receita? Cobrando imposto da sua população.</p><p>A quantidade de impostos que deve ser cobrada entra na polêmica já citada anteriormente. Um governo com mais recursos certamente poderá fazer mais ações para sua população, mas até que ponto os impostos cobrados pelo governo trazem retornos eficientes? Como gerar receita para o governo e continuar com crescimento econômico?</p><p>Arthur Laffer, um economista americano, chegou a seguinte linha de raciocínio:</p><ul><li>se um governo não cobrar imposto (0%) ele não terá receita</li><li>se um governo cobrar 100% de imposto, ninguém trabalha e ele também não terá receita</li><li>conforme o percentual de imposto cobrado se distância de 0% a receita vai aumentando</li><li>conforme o percentual de imposto cobrado se aproxima de 100% a receita vai diminuindo</li><li>existe um percentual entre 0% e 100% onde o retorno da receita é maximizado</li></ul><p>Essa lógica é mais conhecida pelo nome dado ao seu gráfico, a Curva de Laffer</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*4n_Xo-I9FvOt6ReDSQMrYA.png" /></figure><h3>Controvérsias sobre o ponto máximo</h3><p>Como boa parte dos assuntos econômicos a curva de Laffer gera debate até hoje. Várias teorias sobre onde estaria o ponto máximo de receita surgiram. O movimento de esquerda acredita que ele está mais próximo dos 100%, já o movimento de direita considera o ponto máximo bem mais perto do 0%. A figura abaixo trás o gráfico segundo cada um dos movimentos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*O4pRpt966qyyf5WS9K7_1Q.png" /><figcaption>A Curva de Laffer segundo os movimentos ideológicos: Direita vs Esquerda</figcaption></figure><p>Quem defende que o ponto máximo está mais próximo de 0% acredita que a redução nos impostos fará com que haja um aumento na produção, o que acaba gerando mais receita como consequência. Imagine um país que cobra 70% de impostos e gere 1 milhão de renda. Nesse cenário o governo recebe 700 mil de impostos. Digamos que uma redução nos impostos para 30% traria um impulso para a economia de 400%. Nesse novo cenário econômico seriam gerados 5 milhões de renda e 1,5 milhões de imposto. Tanto o governo como a população ganhariam com a redução.</p><p>Do outro lado está o pessoal que defende que a redução não trará esse boom na economia. A crença de que o ponto máximo está mais próximo dos 100% faz com que um cenário com diminuição de impostos seja considerado um cenário onde o governo recebe menos dinheiro. A ideia é que uma cobrança maior de impostos não inibiria uma produção por parte dos empresários, gerando assim mais receita para o governo, que poderia aumentar seus gastos com a população.</p><h3>Existe fórmula “mágica”?</h3><p>A Curva de Laffer não é uma fórmula matemática que deve ser seguida cegamente, mas sim uma teoria que serve para entendermos melhor a cobrança de impostos feita pelo governo. Na prática ela não é tão simples como os gráficos mostram, pois não será formada uma parábola, mas sim um gráfico com diversos pontos altos e baixos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*F0EpiWgnD9q_qyCOs8-kIg.jpeg" /><figcaption>A Curva de Laffer de maneira mais realista</figcaption></figure><p>Outra questão relevante é que a Curva de Laffer trata o reflexo causado pela porcentagem do imposto de maneira isolada, o que dificilmente acontecerá no mundo real. Uma redução de imposto pode surtir bons resultados em um local (<a href="http://www.heritage.org/research/commentary/2015/7/reagans-tax-cutting-legacy">como aconteceu em 1980 com o presidente Reagan</a>), porém pode trazer resultados negativos em outro (<a href="https://www.bloomberg.com/view/articles/2016-03-29/kansas-tried-tax-cuts-its-neighbor-didn-t-guess-which-worked">como aconteceu com Kansas em 2014</a>). Talvez a forma mais eficiente de trabalhar a questão seja de forma empírica, observando as particularidades de cada localidade e ajustando a porcentagem de impostos conforme for conveniente.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ed14465116d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devaneiosliterarios/curva-de-laffer-3ed14465116d">Curva de Laffer</a> was originally published in <a href="https://medium.com/devaneiosliterarios">Devaneios Literários</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>