<?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" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Cloud Solutions - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Cloud Solutions - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Sat, 16 May 2026 19:39:37 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/cloud-solutions/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ What is Cloud-Native? And How to Make it Fast ]]>
                </title>
                <description>
                    <![CDATA[ By Sumeet Ninawe Web applications are built to provide various online services to end-users. Developing and hosting these services involves hard work and talent. And it all begins with an idea. But imagine, after putting in all that hard work, users ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-improve-cloud-native-system-performance/</link>
                <guid isPermaLink="false">66d460143bc3ab877dae220e</guid>
                
                    <category>
                        <![CDATA[ Cloud Computing ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Cloud Solutions ]]>
                    </category>
                
                    <category>
                        <![CDATA[ performance ]]>
                    </category>
                
                    <category>
                        <![CDATA[ web performance ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Tue, 14 Jun 2022 20:14:40 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/06/jeshoots-com-sMKUYIasyDM-unsplash.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Sumeet Ninawe</p>
<p>Web applications are built to provide various online services to end-users. Developing and hosting these services involves hard work and talent. And it all begins with an idea.</p>
<p>But imagine, after putting in all that hard work, users cringe about the performance of the system – “It's too slow...”, “I wish I could get the response in this lifetime...”, “The product is good, but not really worth waiting for...” and they go on. </p>
<p>On the other hand, if you decide to provide your users with the best performance but you've got a poorly architected system, then your infrastructure costs can soar.</p>
<p>In this article, will see how making the right trade-offs matter. </p>
<p>Think of a music concert. Everyone's there, waiting to enjoy their favorite acts live. There are so many audio parameters associated with every line of input and output that runs across the stage, and those need to be set at an <em>optimum</em> level. </p>
<p>Blasting everything to its full level would make people leave the concert. Of course, this is not the artist’s fault – but the sound engineer who's job it is to make the artist sound good.</p>
<p>After all, this is a production system – similar to IT production environments. In IT, managing the system's performance essentially means managing the tradeoffs well. Of course, there are clear choices, but at times, making those straightforward choices is not so obvious.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/06/Basic-Web-Arch.png" alt="Image" width="600" height="400" loading="lazy">
<em>Basic Web Application Infra Design</em></p>
<h2 id="heading-what-is-cloud-native">What is Cloud-Native?</h2>
<p>Deploying business applications and services on managed data centers, also known as the cloud, is a long-running trend in the IT industry. This is mainly because the cloud offers numerous benefits and expertise while offering data-centers as a service.</p>
<p>Security, regulatory, and operational challenges still exist, so organizations are still lagging as far as moving 100% of their workloads to the cloud. On the other hand, startups go pro-cloud deployment as it is much easier to get your infrastructure managed by the cloud platforms from day one.</p>
<p>But what do we mean by cloud-native? You may think that merely shifting your workloads to the cloud will help you reap maximum benefits. That is partly true, since there are stages of cloud adoption. Cloud providers offer many rich infrastructure services, and when leveraged properly, they can drastically reduce your IT infrastructure costs.</p>
<p>The term "cloud-native" indicates the degree of cloud adoption in an organization. You might have come across cloud migration projects executed by organizations where they shift their workloads from on-prem hardware servers to VMs in the cloud. This is useful, as they benefit from getting rid of the effort required to maintain data centers themselves – but the situation could still be better.</p>
<p>Mere lifting and shifting of workloads is not very intelligent and is not cloud-native. Cloud platforms offer many more services like container registries, cluster management solutions, DevOps services, Serverless/Function-as-a-Service, and so on. All together, these give better results – in terms of everything, like cost, performance, maintenance, flexibility, reliability, security, and so on.</p>
<p>The notion of going cloud-native means adopting as many services provided by cloud providers as you're able, and aligning or refactoring your workloads to be deployed on the cloud in the most beneficial manner. </p>
<p>With that in mind, let's see how cloud-native adoption can help you improve the performance of your systems.</p>
<h2 id="heading-how-to-improve-your-systems-performance">How to Improve Your System's Performance</h2>
<p>When it comes to architecting any IT system, performance is one of the key aspects. We can classify the performance topics discussed below into three broad categories – compute, storage and memory, and network. Such categorization helps us look at the system from various lenses, and isolate the issues.</p>
<h3 id="heading-1-workload-partitioning">1. Workload Partitioning</h3>
<p><em>Category: Compute</em></p>
<p>You might be aware that monolithic architectures represent the single point of failure. The probability of the entire system going down is high, even due to trivial issues. </p>
<p>The emergence of microservice architecture has helped solve this problem, but it also depends on how those microservices are designed.</p>
<p>While refactoring a monolith into microservices, you should follow the single responsibility principle. Build one microservice for one purpose only, and deploy multiple instances of critical microservices in auto-scaling mode to avoid the drop in performance. </p>
<p>This kind of workload partitioning helps tackle issues in an isolated way, reducing the risk of failures.</p>
<p>One of the first services offered by cloud providers was perhaps the ability to spin up virtual machines as needed. We can choose the flavor of the OS, size, networking, and various other aspects. Leverage this flexibility to deploy partitioned workloads.</p>
<p>Going a step ahead, you can isolate the runtime requirements for the services using containerization. This could be OS resources, CPU, network bandwidth, memory, and so on, where the quota can be predefined. This allows shared but dedicated resource allocation, thus breaking the one application, one server rule.</p>
<p>When workloads are containerized, it provides a firm base system that ensures its performance on any system that supports running container workloads – independent of hardware or OS.</p>
<p>Cloud providers also provide container orchestration services (for example Kubernetes), making it easier to deploy, debug and release newer versions of applications without downtime. Using these services and a wise deployment strategy can help roll out new features without any lag or glitch in the user experience.</p>
<p>I want to highlight that you should break your applications into microservices and host each service on isolated infrastructure. This avoids a lot of inter-process interference and resource contentions, thus optimizing the resource consumption for performance.</p>
<h3 id="heading-2-compute-optimization">2. Compute Optimization</h3>
<p><em>Category: Compute</em></p>
<p>Every application has different needs. Standard VMs offer everything that is required in a general-purpose server – CPU, Memory, and Networking capabilities. </p>
<p>However, not every application running on these VMs follows a standard as far as resource consumption is concerned. Applications or microservice components are purpose-driven, in a way that they have different computing needs. </p>
<p>A frontend server may rely more on networking capabilities as compared to its compute or memory requirements. A microservice dealing with large data transformation activities may need a better memory management solution for accessing the memory and performing transactions.</p>
<p>Major cloud providers offer features to optimize the virtual resources – especially VMs and databases – to align them with the application’s needs. In general, these optimizations can be categorized into three groups:</p>
<ol>
<li>Compute-optimized</li>
<li>Memory-optimized</li>
<li>Storage-optimized</li>
</ol>
<p>Depending on the criticality of the applications, there are options that help you optimize costs. You just need to choose the appropriate pricing plan and then trade off the availability of critically low applications with cost benefits.</p>
<p>Optimized virtual servers are selected depending on their purposes:</p>
<ol>
<li>Batch processing, heavy data transform workloads, and ML algorithms usually need high-performance processors given their compute-intensive tasks. Choose to provision memory optimized instances for this purpose. Compute optimized instances are provisioned with enhanced block and file storage, along with widened network bandwidth. This helps churn out the best performance to process data oriented workloads.</li>
<li>If your app needs to deliver high network performance to transfer high volumes of data and serve a high volume of requests, then it is important to choose the right networking hardware associated with a provisioned VM. In this case, you can choose to optimize the network performance by opting for a high performance network interface card.</li>
<li>SSD-based volumes are used to assist CPU performance if the processing needs multiple transactions on the memory. A storage optimized VM helps with faster IO operations, and it's tuned for high throughput. Compared to using a general purpose VM, storage optimized VMs deliver greater performance.</li>
</ol>
<p>It is important to analyze the system requirements for a given workload. A balanced configuration offered by general purpose VMs may just result in higher costs without significant improvement in the performance. You can make a wise choice by taking a look at types of VMs which can be provisioned.</p>
<h3 id="heading-3-scaling">3. Scaling</h3>
<p><em>Category: Compute</em></p>
<p>There are 2 types of scaling:</p>
<ol>
<li>Scaling up – where the virtual compute resources scale by their size.</li>
<li>Scaling out – where they scale in numbers.</li>
</ol>
<p>In the cloud-native world, both options are available. Given the nature of templated size selection – the scaling up of resources is not always the best case since applications may experience bottlenecks in one of the aspects. Increasing the size of everything in a VM to address a single bottleneck creates under-utilized resources. This simply adds to the costs.</p>
<p>Besides, scaling up also means we are scaling a single point of failure. The better option would be to scale out in numbers. That way, even if a node fails, there are still others to serve the users and avoid potential losses.</p>
<p>Cloud providers offer an auto-scaling feature which lets you be sure that as many instances as you need are always up and running even if some of them fail in the meanwhile. This is done automatically.</p>
<p>But that does not mean there is no reason to worry about node failures. Ideally, the nodes should not fail at all, and autoscaling only provides a fallback mechanism as an attempt to recover from the loss. This in itself is a virtue.</p>
<p>Going a step ahead, Kubernetes capabilities provided by cloud-native platforms add an additional level of customization of resource allocation. From compute’s perspective, this means we have better ways to manage bottlenecks.</p>
<h3 id="heading-4-serverless">4. Serverless</h3>
<p><em>Category: Compute</em></p>
<p>Going beyond containers – if you don’t want to worry about the vulnerability scans in images used, cluster management, OS, and orchestration, and you only want to write the code and let it run, then serverless is a great option.</p>
<p>In the serverless services offered by cloud providers, you are only expected to write “functions'' that define the logic for your hosted application. All the infrastructure required to run these functions is abstracted by the cloud provider platforms.</p>
<p>Apart from the huge cost benefits offered by serverless (topic for another day), developing applications on the serverless framework is the closest thing to cloud-native. The more cloud-native you are, the more services you can leverage.</p>
<p>It should be noted that serverless does not just mean writing code. The cloud providers may only provide a place to execute the incoming request. The way that request is processed and routed to appropriate queues and APIs requires leveraging additional services.</p>
<p>However, refactoring existing applications requires huge efforts, which is where containerization is an easier option to begin with. Applications, especially web services to be developed from scratch, are often good candidates for serverless.</p>
<h3 id="heading-5-database-partitioning">5. Database Partitioning</h3>
<p><em>Category: Memory &amp; Database</em></p>
<p>Partitioning a database offers a clear advantage on performance. Think of it as a high level classification of the data itself that is stored in large volumes.</p>
<p>When a query is run against these volumes, chances are that the entire database or the storage volume is scanned to fetch the requested data. Partitioning reduces the scope of this scan, thus improving the response time. A good partitioning strategy is defined based on the stored data itself.</p>
<p>For example, an archive of all the newspapers from the year 2000 can be partitioned based on year, and further partitioned based on month and so on. So if you know the name and date of the newspaper you would like to read, it would be easier to find it in the archives.</p>
<p>Cloud platforms provide various services as far as the partitioning of the data is concerned. As opposed to the traditional ways, all the partitioning needs are handled by the platform itself once configured. So consider partitioning the data.</p>
<h3 id="heading-6-dynamic-data-caching">6. Dynamic Data Caching</h3>
<p><em>Category: Memory &amp; Database</em></p>
<p>Web applications serve multiple requests in parallel. These requests may require reading the data from the database. If the data is read frequently, each request would need to connect to the database, read it and make it available for the business layer.</p>
<p>If the data being read is the same, then it would make sense to store it in a cache for faster access. This avoids unnecessary, expensive, and frequent round trips to the database layer.</p>
<p>In a multi-node environment, every node may cache its own copy of data. Although it improves performance, it also creates multiple copies of the same data on multiple nodes so it is still very inefficient. </p>
<p>One of the workarounds is to enforce client affinity which makes sure that a particular request is always served by the same node in the cluster. If the node is busy, it introduces additional latency and having multiple nodes in the cluster does not serve the purpose.</p>
<p>This is where shared cache databases come into the picture. Redis and memcached are the most used shared cache databases, which are used in backend architecture of many web applications. </p>
<p>Shared cache databases are not the replacement for databases – they help in storing data for fast retrieval of temporary data. They are usually hosted between the business logic nodes and database.</p>
<p>Shared cache databases help consolidate database transactions and keep the database state consistent. Once installed and configured, you can use them to set and get values. So instead of maintaining the node-specific copy of data, using shared cache database helps keep the data, once stored, available for all the nodes.</p>
<p>Cloud providers offer support, solutions, and services to host Redis and memcached to enhance performance of the systems.</p>
<h3 id="heading-7-consider-eventual-consistency">7. Consider Eventual Consistency</h3>
<p><em>Category: Memory &amp; Database</em></p>
<p>In terms of databases, consistency defines if the immediate reads are up-to-date with the latest written information. Applications that perform many IO tasks to the databases have the tendency to use locking mechanisms to make sure multiple intended writes happen in a consistent way. </p>
<p>However, when such frequently changing data is being read, especially where multiple reads are allowed, the data can either be consistent with the latest write or not. </p>
<p>When multiple readers are enabled, in some cases the database is also replicated to have a real-time or near real-time copy of the primary database (the purpose of which is to serve all the read requests).</p>
<p>In such cases if you need consistency, then that adds to the performance lag as all the read operations have to be suspended until the write operations are replicated on all the copies of the database.</p>
<p>When you're developing business critical services, distributed relational databases that have ACID compliance/guarantees can result in a rather slower system.</p>
<p>Eventual consistency is a feature mostly offered by NoSQL and Document databases. Eventual consistency is a guarantee that the data that is being read and displayed to the user is up-to-date with latest write and will be updated in the database.</p>
<p>Cloud providers offer NoSQL and Document database services which also offer eventual consistency. Improving system performance by enabling eventual consistency and simultaneously protecting data integrity is a challenge that needs an overarching solution.</p>
<p>Identify the cases where you can take advantage of eventual consistency and develop routines and transactions to support end-to-end data integrity. This will help improve performance. Cloud native solutions provide this ability, and eventual consistency also helps with cost optimizations.</p>
<h3 id="heading-8-leverage-the-backbone-network">8. Leverage The Backbone Network</h3>
<p><em>Category: Network</em></p>
<p>As far as networking is concerned, well established Cloud-Native platforms have data centers and server farms in various locations spread across the globe. It doesn’t matter where the traffic is coming from – it's likely that these cloud providers have a datacenter available in their vicinity.</p>
<p>These data centers are connected with a backbone network which is also developed by the cloud providers that are dedicated for their inter-regional communication. This is a great advantage. If the application users live on multiple continents, deploying applications on the cloud inherently accelerates the delivery of your services thanks to these backbone networks. </p>
<p>Since this is a global network supporting all the services, hosting cloud-native applications can be served closer to the users regardless of their continent or country. </p>
<p>Direct and dedicated connections and VPNs are also used to connect on-prem or private data centers securely to the cloud infrastructure in the form of access points. In a way, establishing these connections helps onboard the organizations network on this backbone network, helping them reach their employees across the globe.</p>
<h3 id="heading-9-api-gateway-caching">9. API Gateway Caching</h3>
<p><em>Category: Network</em></p>
<p>Like other services, cloud providers provide services for hosting and configuring API gateways for your applications. Today, APIs are the first choice of interface for any web application.</p>
<p>API Gateways not only help develop these API paths, they are also seamlessly integrated with other services related to compute, storage, databases, functions, containers, orchestrations, queues, and so on. The rich Web UI makes it easy to configure API Gateways and maintain versions of the same.</p>
<p>Since APIs deal with sending and receiving payload data, there are several pre-built features which assist in formatting, encoding, and security of payloads. Since these advanced features are pre-built in these API Gateway services, the efforts required to configure these for optimum delivery are low.</p>
<p>You can leverage these features for automatic compression, decompression, classify and route requests to target service, enable cache to improve latency of application response.</p>
<h3 id="heading-10-cdns">10. CDNs</h3>
<p><em>Category: Network</em></p>
<p>Considering the fact that cloud providers offer their own backbone network that carries dedicated traffic between their data centers, it becomes very convenient for them to provide CDN services as well.</p>
<p>Major cloud platforms offer CDN services that give really good results as far as content delivery of static data is concerned. Web applications being served to users via Web Browser typically use HTML, CSS, JS files to build the interactive user interface. These files are fairly static and do not change very frequently.</p>
<p>While applications are being deployed on cloud platforms, it makes sense to take advantage of CDN services to improve the network performance of these applications.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>When we talk about optimizing the performance of the cloud-native system, there are many more factors involved. It is important to think about the system using various lenses – compute, storage, databases, and networking – and identify the bottlenecks by performing various load and stress tests.</p>
<p>Monitoring is an important feature which many major cloud companies provide, and is well-integrated with other services. Leverage these monitoring capabilities to analyse the performance bottlenecks and identify effective action items for change.</p>
<p>I have covered challenges and approaches with deeper insights in my <a target="_blank" href="https://www.letsdotech.dev/resources/ebook-cloud-native-system-performance/">FREE eBook</a> published on my website <a target="_blank" href="https://letsdotech.dev">Let's Do Tech</a>. If you are interested in following more of the architectural stuff, do keep an eye on me. Social: <a target="_blank" href="https://www.instagram.com/letsdotech/">Instagram</a>, <a target="_blank" href="https://twitter.com/letsdotech_dev">Twitter</a>, <a target="_blank" href="https://www.linkedin.com/company/letsdotech">LinkedIn</a>, <a target="_blank" href="https://www.facebook.com/ldtmavens">FB</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ AWS IAM – Policy, Access Roles, Resources Explained, and Why They're Useful ]]>
                </title>
                <description>
                    <![CDATA[ By Periklis Gkolias IAM, or Identity and Access Management, is one of the most common terms you'll hear in cloud-native environments. But what does it do? And if you're already familiar with IAM, how long did it take you to fully understand it? I wil... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/the-introduction-to-iam-i-wish-i-had/</link>
                <guid isPermaLink="false">66d4609df855545810e934c3</guid>
                
                    <category>
                        <![CDATA[ Cloud Services ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Cloud Solutions ]]>
                    </category>
                
                    <category>
                        <![CDATA[ IAM ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Thu, 07 Apr 2022 02:50:41 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/04/g7In5Xr-2.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Periklis Gkolias</p>
<p>IAM, or Identity and Access Management, is one of the most common terms you'll hear in cloud-native environments.</p>
<p>But what does it do? And if you're already familiar with IAM, how long did it take you to fully understand it?</p>
<p>I will explain the main concepts behind this massive family of software, with you, the busy engineer, in mind.</p>
<p>The fundamentals described here are vendor agnostic, though most of my experience is with AWS's implementation.</p>
<h2 id="heading-what-is-iam">What Is IAM?</h2>
<p>IAM is a complex system of entities (humans, applications, and so on) that request access to a system. It is also a hierarchical set of rules to grant or deny requested access.</p>
<p>Before we go any further, here are the main terms you'll encounter:</p>
<ul>
<li><strong>Resource</strong>: Anything worth protecting. A storage service, virtual machine, etc.</li>
<li><strong>Policy</strong>: A set of rules that dictate who can and can't do something on a single resource or group of resources.</li>
<li><strong>Action</strong>: Anything someone can do inside the cloud environment. For example, creating a virtual machine.</li>
<li><strong>User</strong>: Well... A user :)</li>
<li><strong>Group</strong>: A group of users with the same permissions applied.</li>
<li><strong>Principal</strong>: A user or an application requesting access.</li>
<li><strong>Role</strong>: A set of powers assigned to a principal, usually for a limited amount of time.</li>
</ul>
<h2 id="heading-why-iam-is-useful">Why IAM Is Useful</h2>
<p>IAM is mainly used for authentication, authorization, granular access, and governance.</p>
<p>Let's see what those all mean:</p>
<ul>
<li><strong>Authentication</strong>: The act over verifying who you are.</li>
<li><strong>Authorization</strong>: The act of identifiying if someone can perform the action they are requesting. This is usually combined with authentication, but not always.</li>
<li><strong>Granular access</strong>: Permissions that control each action that can happen on a resource. For example, a user might have permission to see firewall rules, but doesn't have permission to change them. This is implemented with <a target="_blank" href="https://en.wikipedia.org/wiki/Role-based_access_control">Role-Based Access Control</a>.</li>
<li><strong>Governance</strong>: The actions you take to know what is happening in your environment, mostly for reasons of budget, compliance, and proper access scope.</li>
</ul>
<p>If you're a company of 1-3 people, then setting up a full-blown IAM solution is probably overkill. Buf if your team is larger than that, or you're planning to scale up, then you should start considering it.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/04/WxyvyO4.jpg" alt="IAM pillars" width="600" height="400" loading="lazy"></p>
<h2 id="heading-common-problems-you-dont-use-iam">Common Problems You Don't Use IAM</h2>
<p>I believe you can see the benefits of an IAM solution.</p>
<p>Now let's take a look at some common problems organizations face in the absence of it.</p>
<h3 id="heading-its-hard-to-audit-and-administer-access">It's Hard to Audit and Administer Access</h3>
<p>Have you heard of cases where an employee had more access than they should? And additionally, no one knew?</p>
<p>This can be prevented with a properly set-up IAM solution.</p>
<h3 id="heading-setting-up-accounts-for-new-hires-is-a-pain">Setting Up Accounts for New Hires Is a Pain</h3>
<p>With an IAM solution in place, this would just be a matter of a few clicks. Namely, set up the users and add them to the IAM groups their teams use. That's it.</p>
<p>But without an IAM solution? You would need to set all the permissions for each account manually.</p>
<p>You might have a reference user to copy from, but does each new account need all the permissions the reference user has? Do you have special handling for user accounts that are less than 6 months old? Does the reference user have superuser permissions that should not be accidentally assigned to a new hire's account?</p>
<h3 id="heading-offboarding-people-is-time-consuming">Offboarding People Is Time Consuming</h3>
<p>Here you'll have similar problems to the new hire case above. But when a collegue is leaving, you'll need to change the password to all the accounts they <strong>potentially</strong> used.</p>
<p>This can turn ugly very fast, not to mention the side effects this has on other team memebers.</p>
<p>And you would have to do this for every script, application, and other resource whenever there's an offboarding. What if you have a team change 2-3 times per month? You and your team would have a hard time being productive.</p>
<h3 id="heading-simple-things-require-human-intervention">Simple Things Require Human Intervention</h3>
<p>Without an IAM solution, tasks like resetting a password or re-enabling an account that was locked need to be done manually.</p>
<p>Top-tier IAM solutions have a way to resolve such issues fast without much hassle.</p>
<h2 id="heading-best-practices">Best Practices</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/04/M7N8blv.jpg" alt="Best practices" width="600" height="400" loading="lazy"></p>
<p>If you've decided to set up IAM, here are some best practices. This is far from a full list, and is based on my personal experience. But I've seen these practices on more than one team, so they should work for you as well.</p>
<h3 id="heading-never-grant-full-access-ever">Never Grant Full Access... EVER</h3>
<p>In a real-world scenario, you wouldn't want every user to have unlimited access to an account. Ideally, no one should full access to anything (apart from the account owner).</p>
<p>For example, if an employee's responsibility is to monitor logs, they should have read access only to that tool. They should not be able to restart a service, or view billing information.</p>
<h3 id="heading-prefer-groups-to-multiple-users">Prefer Groups to Multiple Users</h3>
<p>It's better to use groups instead of multiple users when you have a choice. Groups make administration exponentially easier.</p>
<p>For example, if a new person joins your organization as a developer, they can be added to an IAM group for developers. That new person will then inherit all the powers of that IAM group.</p>
<p>The alternative, creating a user for each group (reader_susan, admin_susan) is considered obsolete.</p>
<h3 id="heading-prefer-roles-on-existing-users-to-creating-a-new-user">Prefer Roles on Existing Users to Creating a New User</h3>
<p>When given the option, prefer assigning a role to an existing user rather than creating a new user.</p>
<p>For example, don't create an admin user and share the password between 10 people. Create an admin role and assign it to whoever needs it for a limited amount of time.</p>
<h3 id="heading-audit-permissions-frequently">Audit Permissions Frequently</h3>
<p>It is easy to make mistakes or perform malicious actions. At the very least, a company should audit permissions regularly, and ensure that only the proper people have the minimum level of access necessary for their roles.</p>
<p>You could also send an email to a certain team when a suspicious action happens. For example, assigning an admin role to a new hire.</p>
<h3 id="heading-set-up-boundaries-beforehand">Set Up Boundaries Beforehand</h3>
<p>If an IAM solution allows for it, add boundaries to your ecosystem.</p>
<p>According to Amazon's documentation:</p>
<blockquote>
<p>A permissions boundary is an advanced feature for using a managed policy to set the maximum permissions that an identity-based policy can grant to an IAM entity. An entity's permissions boundary allows it to perform only the actions that are allowed by both its identity-based policies and its permissions boundaries.</p>
</blockquote>
<p>(I know, I know — I promised to be vendor-agnostic 🙂)</p>
<p>In layman's terms, you can define the "maximum" permissions that can be assigned to anyone.</p>
<p>For example, a user will at most be able to view the logs from the relevant tool and restart a service. If someone attempts to get a role to create a new virtual machine they will be disallowed.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Thank you for reading this far. I hoped you enjoyed this introduction to IAM.</p>
<p>If you have any questions, please reach out to me on Twitter.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to host and deploy a static website or JAMstack app to AWS S3 and CloudFront ]]>
                </title>
                <description>
                    <![CDATA[ S3 and CloudFront are AWS cloud services that make serving static assets powerful and cheap. How can we host a simple static website or JAMstack app on it? A little about AWS What are the benefits of serving from S3 and CloudFront? Before we start, ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-host-and-deploy-a-static-website-or-jamstack-app-to-s3-and-cloudfront/</link>
                <guid isPermaLink="false">66bee8fdf53892da32acd273</guid>
                
                    <category>
                        <![CDATA[ AWS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ beginners guide ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Cloud ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Cloud Services ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Cloud Solutions ]]>
                    </category>
                
                    <category>
                        <![CDATA[ cloudfront ]]>
                    </category>
                
                    <category>
                        <![CDATA[ HTML ]]>
                    </category>
                
                    <category>
                        <![CDATA[ JAMstack ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ S3 ]]>
                    </category>
                
                    <category>
                        <![CDATA[ software development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Static Site Generators ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Tutorial ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Colby Fayock ]]>
                </dc:creator>
                <pubDate>Wed, 11 Mar 2020 13:16:31 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2020/03/static-website-in-aws-s3.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>S3 and CloudFront are AWS cloud services that make serving static assets powerful and cheap. How can we host a simple static website or JAMstack app on it?</p>
<ul>
<li><a class="post-section-overview" href="#heading-a-little-about-aws">A little about AWS</a></li>
<li><a class="post-section-overview" href="#heading-what-are-the-benefits-of-serving-from-s3-and-cloudfront">What are the benefits of serving from S3 and CloudFront?</a></li>
<li><a class="post-section-overview" href="#heading-before-we-start-youll-need-an-aws-account">Before we start, you’ll need an AWS account</a></li>
<li><a class="post-section-overview" href="#heading-storing-your-website-on-s3">Storing your website on S3</a></li>
<li><a class="post-section-overview" href="#heading-serving-your-website-on-s3">Serving your website on S3</a></li>
<li><a class="post-section-overview" href="#heading-distributing-your-website-on-cloudfront">Distributing your website on CloudFront</a></li>
<li><a class="post-section-overview" href="#heading-custom-domain-names">Custom domain names</a></li>
<li><a class="post-section-overview" href="#heading-advanced-aws-usage">Advanced AWS Usage</a></li>
<li><a class="post-section-overview" href="#heading-resources">Resources</a></li>
</ul>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/1lDGDzmbQWg" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<h2 id="heading-a-little-about-aws">A little about AWS</h2>
<p>If you’re not familiar, <a target="_blank" href="https://aws.amazon.com/">AWS</a> (Amazon Web Services) is a cloud service provider that gives developers opportunities to build pretty much anything they can imagine in the cloud.</p>
<p>Though their <a target="_blank" href="https://aws.amazon.com/products/">services</a> extend beyond the likes of <a target="_blank" href="https://aws.amazon.com/machine-learning/">machine learning</a> and <a target="_blank" href="https://aws.amazon.com/ai/">artificial intelligence</a>, we’re going to stick with the entry level services for the purpose of this guide that will allow us to easily host an HTML website.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-services-overview.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Types of AWS services available</em></p>
<p>Building a site with S3 and CloudFront is a common recipe that small and high scale companies across the web use, but let’s break down what each service actually does.</p>
<h3 id="heading-object-storage-with-s3">Object storage with S3</h3>
<p><a target="_blank" href="https://aws.amazon.com/s3/">S3</a> (Simple Storage Service) acts as your hosting for your static website. Think of it like a hard drive in the cloud which we’re not able to use it for processing purposes, but rather for simple file storage and access.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-s3-bucket-file-list.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>List of files from a static site in an AWS S3 bucket</em></p>
<p>When an app or website is compiled in static form, this is all we need to serve it to the people visiting our site. The HTML is sent in the initial request “as is” (unless there’s processing with your provider) and any additional work occurs after the page loads in the browser usually by JavaScript. This allows us to take this simple (and cheap) approach by serving these files from S3.</p>
<h3 id="heading-content-delivery-network-with-cloudfront">Content Delivery Network with CloudFront</h3>
<p><a target="_blank" href="https://aws.amazon.com/cloudfront/">CloudFront</a> works as a <a target="_blank" href="https://en.wikipedia.org/wiki/Content_delivery_network">CDN</a> (Content Delivery Network) that sits in front of your website, caching the files, and serving them directly to the people visiting your site.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/cdn-distribution-map.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>CDN Diagram</em></p>
<p>Where you host and serve your website from, typically called the origin, is the main source of your files and can serve the website itself. But putting a CDN in front of it provides the people accessing your content a shorter and faster way to make their request.</p>
<h2 id="heading-what-are-the-benefits-of-serving-from-s3-and-cloudfront">What are the benefits of serving from S3 and CloudFront?</h2>
<p>Given the rise in the <a target="_blank" href="https://jamstack.org/">JAMstack</a> era, many services are popping up that provide similar services for static sites that make it really easy to deploy. Some even come with a generous free tier like <a target="_blank" href="https://www.netlify.com/">Netlify</a> and <a target="_blank" href="https://zeit.co/">Zeit</a>!</p>
<p>But sometimes developers need a little bit more control over their services or they need to integrate into a larger cloud pipeline that’s already 99% percent in AWS, which is exactly where S3 shines. Also, chances are, during your first year you might still qualify for AWS’s <a target="_blank" href="https://aws.amazon.com/free/">free tier</a>.</p>
<h3 id="heading-fitting-in-to-the-aws-well-architected-framework">Fitting in to the AWS Well-Architected Framework</h3>
<p>As a lead provider in cloud services, AWS has published many guides to help developers and teams strive for excellence in their solutions in terms of performance, cost, and security.</p>
<p>One particular guideline is their 5 pillars of what they describe as a <a target="_blank" href="https://aws.amazon.com/architecture/well-architected/">“well-architected" infrastructure</a>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-well-architected-framework.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>AWS Well-Architected Framework</em></p>
<p>By default, we check all of these boxes with our hosting solution by using S3 and CloudFront. Out of the box, the HTML and assets you serve will be fast, cheap, secure, and reliable.</p>
<h3 id="heading-the-beauty-of-static-and-jamstack-sites">The beauty of static and JAMstack sites</h3>
<p>Building on top of the pillars, what you’re actually serving is a static HTML file and group of assets that won’t require any type of rendering resources on the initial request. Before this, a common problem was having to worry about a site crashing due to heavy load. But with S3 and CloudFront, your website is infinitely scalable.</p>
<p>On a similar note, when that server scales up as it's trying to serve millions of hits on your post that went viral, so will your costs. Serving a static site is cheap and can greatly reduce the cost associated with running a web server.</p>
<h2 id="heading-before-we-start-youll-need-an-aws-account">Before we start, you’ll need an AWS account</h2>
<p>To work through this guide, you’ll need an AWS account. Luckily, it's free to create an account – you’ll only pay for the services used.</p>
<p>On top of that, AWS provides a generous free tier for some of its services. Some services provide only 12 months of a free tier (like S3) where others are always eligible for the free tier (like <a target="_blank" href="https://aws.amazon.com/lambda/">Lambda</a>), so make sure to do your homework so you don’t rack up an unexpectedly high bill.</p>
<p>To create your account, head over to the AWS website and then continue on to get started: <a target="_blank" href="https://aws.amazon.com/">https://aws.amazon.com/</a>.</p>
<h2 id="heading-storing-your-website-on-s3">Storing your website on S3</h2>
<p>To get started, we’re going to begin with a simple HTML file that will serve as our website. This will allow us to focus more on the process of hosting rather than the intricacies of the website itself.</p>
<h3 id="heading-creating-our-website-file">Creating our website file</h3>
<p>Begin by creating a new folder called <code>my-static-site</code>. Inside that folder, let's create a new file called <code>index.html</code> and add the following to the file:</p>
<pre><code class="lang-html"><span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">“en”</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">“UTF-8”</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">“viewport”</span> <span class="hljs-attr">content</span>=<span class="hljs-string">“width</span>=<span class="hljs-string">device-width,</span> <span class="hljs-attr">initial-scale</span>=<span class="hljs-string">1.0”</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>My Static Website<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Hello World!<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>This is my static website. ?<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<p>If you open this file from your computer in your favorite browser, you should now be seeing this.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/hello-world-local-website-file-1.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Hello World! Opening a local webpage</em></p>
<h3 id="heading-creating-a-new-bucket">Creating a new bucket</h3>
<p>Head on over to your AWS account, log in, and navigate to your <a target="_blank" href="https://s3.console.aws.amazon.com/s3/">S3 console</a>.</p>
<p>Once there, let’s create our bucket by clicking on the blue <strong>Create bucket</strong> button:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-s3-create-bucket.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Creating a bucket in AWS S3</em></p>
<p>The first thing AWS wants us to do is enter a <strong>Bucket name</strong>. The bucket name must be globally unique, meaning, the name you use can be the only one in the world, so let’s try something like <code>[yourname]-static-website</code>, where I’ll use <code>colbyfayock-static-website</code>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-s3-bucket-name.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Naming a bucket in AWS S3</em></p>
<p>Next, let’s set the <a target="_blank" href="https://aws.amazon.com/about-aws/global-infrastructure/regions_az/"><strong>Region</strong></a>. This is the geographic location where AWS will host the bucket and your website. You’re probably fine with the default, but if you’d like, you can select the location closest to you if it’s permitted. Since I’m in Virginia, I’m going to stick with my default of <strong>US East (N. Virginia)</strong>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-s3-bucket-region.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Setting the region of a bucket in AWS S3</em></p>
<p>Finally, hit the <strong>Create</strong> button on the bottom left of the page.</p>
<p><em>Note: even if you use the <code>[yourname]-static-website</code> pattern, there’s a chance the name will be taken. If it’s taken, AWS will show an error stating “Bucket name already exists,” at which point you’ll want to try a new name of your choosing.</em></p>
<p>Alternatively, you can hit <strong>Next</strong> for advanced usage, but for this guide, we’re okay with all of the defaults S3 provides.</p>
<p>If successful, you should now see your bucket in the list on the S3 console dashboard.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-s3-bucket.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>New bucket in AWS S3</em></p>
<h3 id="heading-uploading-your-website-to-the-bucket">Uploading your website to the bucket</h3>
<p>Let’s navigate to our new bucket by clicking the row of our bucket. You’ll be greeted with a message stating “This bucket is empty. Upload new objects to get started,” so that’s what we’ll do.</p>
<p>Click the <strong>Upload</strong> button to get started.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-s3-bucket-upload.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Uploading files to AWS S3</em></p>
<p>You’ll then see a popup that will ask you to upload a file. Click on the <strong>Add files</strong> button and select your <code>index.html</code> file we created earlier.</p>
<p>Once selected, click the <strong>Upload</strong> button on the bottom left.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-s3-bucket-upload-files.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Selecting files to upload in AWS S3</em></p>
<p>And now your file is uploaded to S3!</p>
<h2 id="heading-serving-your-website-on-s3">Serving your website on S3</h2>
<p>If you try to navigate to your <code>index.html</code> file and open it, you’ll notice a big ugly "Access Denied" message.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-s3-access-denied.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Access Denied to bucket file</em></p>
<p>This is because your file doesn’t currently have the permissions and settings necessary to serve the file to the public, so let’s fix that.</p>
<h3 id="heading-setting-up-your-bucket-as-a-website">Setting up your bucket as a website</h3>
<p>Navigate to the <strong>Properties</strong> tab inside of your bucket, then click <strong>Static website hosting</strong>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-s3-properties-static-hosting.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Setting up an AWS S3 bucket for statice website hosting</em></p>
<p>Once there, we want to do a few things:</p>
<ul>
<li>Note down the <strong>Endpoint</strong> at the top of the block. We’ll use this to access our site later (you can always find this here again)</li>
<li>Select the “Use this bucket to host a website” option</li>
<li>Enter <code>index.html</code> in the <strong>Index document</strong> field</li>
<li>Finally hit <strong>Save</strong></li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-s3-static-website-configuration.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Configuring an AWS S3 bucket for static website hosting</em></p>
<h3 id="heading-setting-up-your-bucket-policy-and-permissions">Setting up your bucket policy and permissions</h3>
<p>Next, navigate to the <strong>Permissions</strong> tab. Here we’ll want to do 2 things: unblock all public access and add a Bucket Policy.</p>
<p>First, on the main page, let’s click <strong>Edit</strong> to unblock all access.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-s3-bucket-permissions.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Configuring an AWS S3 bucket permissions</em></p>
<p>Then, uncheck the “Block all public access” checkbox and hit <strong>Save</strong>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-s3-bucket-block-access.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Allowing public access to an AWS S3 bucket</em></p>
<p>AWS will ask you to confirm these settings, as this may not always be what you want to do with your bucket. But for the purposes of hosting a website, we want the whole world to see, so type in the word “confirm” and hit the <strong>Confirm</strong> button.</p>
<p>After confirming, click the <strong>Bucket policy</strong> button and you’ll be taken to a text editor.</p>
<p>In this text box, we’ll want to paste the following snippet. Within this snippet, make sure to replace <code>[your-bucket-name]</code> with the name of your bucket, otherwise you will not be able to save this file.</p>
<pre><code class="lang-json">{
  <span class="hljs-attr">"Version"</span>:<span class="hljs-string">"2012-10-17"</span>,
  <span class="hljs-attr">"Statement"</span>:[{
    <span class="hljs-attr">"Sid"</span>:<span class="hljs-string">"PublicReadGetObject"</span>,
        <span class="hljs-attr">"Effect"</span>:<span class="hljs-string">"Allow"</span>,
      <span class="hljs-attr">"Principal"</span>: <span class="hljs-string">"*"</span>,
      <span class="hljs-attr">"Action"</span>:[<span class="hljs-string">"s3:GetObject"</span>],
      <span class="hljs-attr">"Resource"</span>:[<span class="hljs-string">"arn:aws:s3:::[your-bucket-name]/*”
      ]
    }
  ]
}</span>
</code></pre>
<p><a target="_blank" href="https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteAccessPermissionsReqd.html#bucket-policy-static-site">This policy</a> states that it’s allowing the public to perform a GetObject request on the S3 resource, which is your S3 bucket.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-s3-static-website-bucket-policy.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Setting up a public policy for an AWS S3 bucket</em></p>
<p>After you add the policy, click the <strong>Save</strong> button. Your should now see a message stating "This bucket has public access.”</p>
<h3 id="heading-previewing-your-new-bucket-website">Previewing your new bucket website</h3>
<p>If you noted down the Endpoint from your Properties page, you can now visit that address to see your website. The endpoint should look like this:</p>
<pre><code class="lang-plaintext">http://[your-bucket-name].s3-website-[region-id].amazonaws.com
</code></pre>
<p>If you didn’t, jump back up a few steps to remind yourself how to find it or look under the Properties tab.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-s3-static-website.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Hello World! Opening an AWS S3 website</em></p>
<p>Congrats, you're halfway there! ?</p>
<h2 id="heading-distributing-your-website-on-cloudfront">Distributing your website on CloudFront</h2>
<p>Now that we have our static website being served from a bucket on S3, let’s take it up another level and serve it across the world using CloudFront.</p>
<h3 id="heading-creating-a-cloudfront-distribution">Creating a CloudFront distribution</h3>
<p>Navigate to your <a target="_blank" href="https://console.aws.amazon.com/cloudfront">CloudFront dashboard</a> and click the <strong>Create Distribution</strong> button.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-cloudfront-create-distribution.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Creating a new distribution in AWS CloudFront</em></p>
<p>Next, select <strong>Get Started</strong> under the <strong>Web</strong> delivery method.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-cloudfront-creating-web-distribution.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Getting started with an AWS CloudFront distribution with Web delivery</em></p>
<p>Here, we’ll enter a few custom parameters to get our distribution set up.</p>
<p>Click into the <strong>Origin Domain Name</strong> field. Once selected, a dropdown list should appear where you can select the S3 bucket you just created. Go ahead and select your S3 bucket.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-cloudfront-distribution-origin-name-1.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Setting the origin domain name in AWS CloudFront to your bucket</em></p>
<p>While you can <a target="_blank" href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html">customize most of the settings</a> to your liking, for our purposes, we’re going to leave all as their default values except for one.</p>
<p>Scroll down to the <strong>Default Root Object</strong> field and type <code>index.html</code>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-cloudfront-distribution-default-root-object-1.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Setting the Default Root Object for a distribution in AWS CloudFront</em></p>
<p>After, scroll down to the bottom and click <strong>Create Distribution</strong> in the bottom right.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-cloudfront-setup-create-1.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Creating an AWS CloudFront distribution</em></p>
<h3 id="heading-previewing-your-new-cloudfront-distribution">Previewing your new CloudFront distribution</h3>
<p>After hitting the <strong>Create</strong> button, it will take some time for your distribution to be created and set up. You’ll notice on the <strong>CloudFront Distributions</strong> list page that the <strong>Status</strong> of your new distribution is <strong>In Progress</strong>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-cloudfront-distribution-in-progress-1.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>AWS CloudFront distribution deployment is In Progress</em></p>
<p>Once this completes, it will say <strong>Deployed</strong>. Then you can find your <strong>Domain Name</strong> in the same row.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-cloudfront-distribution-deployed.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>AWS CloudFront distribution is Deployed</em></p>
<p>Using the value in the Domain Name column, open your distribution in your browser and success! You now are viewing your S3 bucket through CloudFront’s distribution network.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-cloudfront-static-website-1.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Hello World! Opening an AWS CloudFront website</em></p>
<h2 id="heading-custom-domain-names">Custom domain names</h2>
<p>While most of us will probably want to use a custom domain name with our website, we’re not going to dive too deep into that this guide, as there are many ways to set that up depending on where you purchase your domain name.</p>
<p>However, here are a few things to consider.</p>
<h3 id="heading-https-ssl-certificate">HTTPS / SSL Certificate</h3>
<p>If you’re creating your CloudFront distribution to use with a custom domain name, you'll most likely want to configure your distribution with an <a target="_blank" href="https://www.cloudflare.com/learning/ssl/what-is-an-ssl-certificate/">SSL certificate</a> using AWS’s <a target="_blank" href="https://aws.amazon.com/certificate-manager/">Certificate Manager</a>. Alternatively you can provide your own certificate with tools like <a target="_blank" href="https://letsencrypt.org/">Let's Encrypt</a>, but by using ACM, AWS makes it easy to pull in the records for use with your distribution.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/fay.io-ssl-certificate.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Once in ACM, you’ll want to configure the certificate, map what domains and subdomains should match (typically <code>*.domain.com</code>), and then create your certificate to use with your distribution.</p>
<p>To get started, you can check out the AWS guide for <a target="_blank" href="https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-public.html">requesting a public certificate</a>.</p>
<h3 id="heading-cnames-and-aliases">CNAMEs and Aliases</h3>
<p>A common approach to setting up a custom domain is to use a CNAME. CloudFront makes this pretty painless, as you’ll add it as a configuration option when you’re configuring your distribution.</p>
<p>To get started with setting up a CNAME in CloudFront, <a target="_blank" href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html">see the AWS guide</a>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/fay.io-route53-alias.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>If you’re using <a target="_blank" href="https://aws.amazon.com/route53/">Route53</a> to manage your <a target="_blank" href="https://www.cloudflare.com/learning/dns/what-is-dns/">DNS</a>, you can then set up an A record (alias) to point to your distribution. You can learn more <a target="_blank" href="https://aws.amazon.com/premiumsupport/knowledge-center/route-53-create-alias-records/">using this guide</a>.</p>
<h2 id="heading-advanced-aws-usage">Advanced AWS Usage</h2>
<p>For this guide, we walked you through setting up a new static website and app using the AWS console. But whether you want to learn more, improve your deploy efficiency, or want to automate this process, you’ll want to take a it a step further with the AWS CLI or CloudFormation.</p>
<p>While we won’t walk you through how to use these tools here, we’ll get you started with a little bit of an idea of what you’re up against.</p>
<h3 id="heading-aws-cli">AWS CLI</h3>
<p>The <a target="_blank" href="https://aws.amazon.com/cli/">AWS CLI</a> allows someone to perform AWS operations from the command line. This can be incredibly powerful when you want to script out your resource creation or if you simply prefer to do all of your work from the terminal.</p>
<p>Once set up locally, you’ll be able to perform actions like creating a bucket using the following command:</p>
<pre><code class="lang-shell">aws s3api create-bucket —-bucket [your-bucket-name] —-region [bucket-region]
</code></pre>
<p>To get started, check out the AWS CLI <a target="_blank" href="https://github.com/aws/aws-cli">Github page</a> or the AWS CLI <a target="_blank" href="https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html">User Guide</a>    .</p>
<h3 id="heading-aws-cloudformation">AWS CloudFormation</h3>
<p>AWS preaches “infrastructure as code.” It’s the idea that you can spin up your infrastructure using something that’s written in a file, where in this particular case, it would be a CloudFormation template. This allows you to have a repeatable process that will be the same each time you perform the deploy.</p>
<p><a target="_blank" href="https://aws.amazon.com/cloudformation/">CloudFormation</a> allows you to set up a configuration file that will deploy the services and resources of your choosing by pointing to that file with the CLI or by uploading it in the console.</p>
<p>Here’s an <a target="_blank" href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-s3.html#scenario-s3-bucket-website">example from AWS</a> of what that looks like for a static S3 bucket that could serve as a website.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/aws-cloudformation-template-s3.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>AWS CloudFront template example</em></p>
<p>To get started, check out AWS’s CloudFormation <a target="_blank" href="https://aws.amazon.com/cloudformation/resources/templates/">example templates</a> or their <a target="_blank" href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/GettingStarted.Walkthrough.html">Get Started guide</a>.</p>
<h2 id="heading-resources">Resources</h2>
<p>If you’re interested in getting deeper into the AWS ecosystem, here are a few resources to get started:</p>
<ul>
<li><a target="_blank" href="https://www.freecodecamp.org/news/aws-certified-cloud-practitioner-training-2019-free-video-course/">AWS Certified Cloud Practitioner Training 2019 - A Free 4-hour Video Course</a> (freeCodeCamp.org)</li>
<li><a target="_blank" href="https://www.freecodecamp.org/news/awscertified-challenge-free-path-aws-cloud-certifications/">Introducing The #AWSCertified Challenge: A Path to Your First AWS Certifications</a> (freeCodeCamp.org)</li>
<li><a target="_blank" href="https://aws.amazon.com/getting-started/tutorials/">10-Minute Tutorials</a> (AWS)</li>
<li><a target="_blank" href="https://acloud.guru/">A Cloud Guru</a> (Paid courses)</li>
<li><a target="_blank" href="https://aws.amazon.com/solutions/case-studies/">AWS Case Studies</a> (AWS)</li>
</ul>
<div id="colbyfayock-author-card">
  <p>
    <a href="https://twitter.com/colbyfayock">
      <img src="https://res.cloudinary.com/fay/image/upload/w_2000,h_400,c_fill,q_auto,f_auto/w_1020,c_fit,co_rgb:007079,g_north_west,x_635,y_70,l_text:Source%20Sans%20Pro_64_line_spacing_-10_bold:Colby%20Fayock/w_1020,c_fit,co_rgb:383f43,g_west,x_635,y_6,l_text:Source%20Sans%20Pro_44_line_spacing_0_normal:Follow%20me%20for%20more%20JavaScript%252c%20UX%252c%20and%20other%20interesting%20things!/w_1020,c_fit,co_rgb:007079,g_south_west,x_635,y_70,l_text:Source%20Sans%20Pro_40_line_spacing_-10_semibold:colbyfayock.com/w_300,c_fit,co_rgb:7c848a,g_north_west,x_1725,y_68,l_text:Source%20Sans%20Pro_40_line_spacing_-10_normal:colbyfayock/w_300,c_fit,co_rgb:7c848a,g_north_west,x_1725,y_145,l_text:Source%20Sans%20Pro_40_line_spacing_-10_normal:colbyfayock/w_300,c_fit,co_rgb:7c848a,g_north_west,x_1725,y_222,l_text:Source%20Sans%20Pro_40_line_spacing_-10_normal:colbyfayock/w_300,c_fit,co_rgb:7c848a,g_north_west,x_1725,y_295,l_text:Source%20Sans%20Pro_40_line_spacing_-10_normal:colbyfayock/v1/social-footer-card" alt="Follow me for more Javascript, UX, and other interesting things!" width="2000" height="400" loading="lazy">
    </a>
  </p>
  <ul>
    <li>
      <a href="https://twitter.com/colbyfayock">? Follow Me On Twitter</a>
    </li>
    <li>
      <a href="https://youtube.com/colbyfayock">?️ Subscribe To My Youtube</a>
    </li>
    <li>
      <a href="https://www.colbyfayock.com/newsletter/">✉️ Sign Up For My Newsletter</a>
    </li>
  </ul>
</div>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to over-engineer a door lock ]]>
                </title>
                <description>
                    <![CDATA[ By Steven Chan My company’s Internet of Things (IoT) side project began when we couldn’t reset the door lock that we inherited from a previous tenant. It was one of those minor details we learned about after moving in to our new last-minute office. N... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-over-engineer-a-door-lock-863b5d58dd0d/</link>
                <guid isPermaLink="false">66c353cdbc39b1419091be74</guid>
                
                    <category>
                        <![CDATA[ Iot Portal ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Cloud Solutions ]]>
                    </category>
                
                    <category>
                        <![CDATA[ iot ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Raspberry Pi ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Tue, 13 Jun 2017 20:26:38 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*TP9VbFU7DwDvY78ApjObtg.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Steven Chan</p>
<p>My company’s Internet of Things (IoT) side project began when we couldn’t reset the door lock that we inherited from a previous tenant. It was one of those minor details we learned about after moving in to our new last-minute office.</p>
<p>Normally, people just pay for a new one. But our team was too cheap to replace the lock and no one ever wanted to get the door bell. Plus, we’re engineers and we wanted to fiddle with some hardware.</p>
<p>Our goal was to open the door with a phone or wearable technology. We had several options for how to approach the problem. In theory, we could use an app, an integration into another platform, or anything that could send a signal to trigger the door lock.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*ZMY8DHIrRVUYDOEm25cW-Q.jpeg" alt="Image" width="600" height="400" loading="lazy">
<em>Chima Open Door on Pebble and iOS</em></p>
<p>So far in our door lock experiment, we’ve developed solutions for a Slack integration, native iOS and Android apps, the Apple Watch, and Pebble. I’ll focus on the architecture of the mobile apps. I admit the final product is a bit over-engineered, but we just love it!</p>
<h3 id="heading-ios-and-android-architecture"><strong><em>iOS and Android architecture</em></strong></h3>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*_a0ivz5iXmx8CLBTWspoXg.png" alt="Image" width="600" height="400" loading="lazy">
<em>Our IoT door lock project’s architecture</em></p>
<p>What exactly happens when you press the button in our iOS / Android app? An HTTP request is sent to the cloud server, which then triggers a message to the door lock daemon via the client server, which then tells a relay board to open the door lock.   </p>
<p>Traditionally, the door lock is opened with a button beside the door. But with modern technology, the possibilities extend beyond a direct, physical button. In addition to the physical button that triggers the <code>Doorlock Daemon</code> in the diagram, we added two other triggers: a cloud-based trigger, and a Bluetooth Low Energy (BLE) trigger, thanks to our choice of hardware.  </p>
<p>This article focuses on the cloud-based trigger, which is what our door lock app depends on.</p>
<h3 id="heading-starting-from-pressing-the-button-to-a-record-saved-on-skygear-server">Starting from pressing the button to a record saved on Skygear server.</h3>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*Y_5ir6hlMnHyXWrMwLA3Vg.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>When a user presses the open door button on the mobile app, the app accesses the cloud server.   </p>
<p>Two things happen in the cloud server. The first is that a record is saved to our choice of server, <a target="_blank" href="https://docs.skygear.io/guides/">Skygear Cloud Database</a>, which allows you to synchronize your data to the cloud. The server will log when the door access is being requested.</p>
<p>Once a record is saved, it would trigger an <code>after_save</code> function provided by <a target="_blank" href="https://docs.skygear.io/guides/">Skygear Cloud Functions</a>, which runs our code in the cloud without bothering server deployment.  </p>
<p>The <code>after_save</code> function is triggered after a record is saved. <code>def after_open_door_save(record, original_record, db):</code> is triggered asynchronously when a record of type <code>'OpenDoor'</code> is saved. The function publishes a message to the channel <code>'xxx-channel'</code>.</p>
<h3 id="heading-the-node-client-and-clojure-server-on-raspberry-pi">The Node Client and Clojure Server on Raspberry Pi</h3>
<p>The next step is to create a listener for the request. This is where the Node client and a Clojure server on Raspberry Pi come in. The Node client listens to the message in the specified channel on the Skygear server. The Clojure server is the only one with the right to access the Raspberry Pi 3 circuit. Then the Node client issues a request to the Clojure server once it hears any message.   </p>
<p>Here is the script for the Node client, which includes code related to our specific configuration for Skygear. The endpoint and the API Key are for accessing the main server on Skygear. <code>skygear.on('xxx-channel', onReceiveOpenDoor)</code> means to subscribe the function callback (<code>onReceiveOpenDoor</code>) on receiving a message on the <code>'xxx-channel'</code> channel.</p>
<p>The Clojure server directly controls General Purpose Input/Output (GPIO) on a Raspberry Pi. GPIO are the pins on the Raspberry Pi 3. The GPIO connects to the external circuit that is connected with the door magnet.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*d80-lFQeMHleoRI30NzgTA.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Here is the Clojure code showing how the Raspberry Pi opens the door. Once the Clojure server receives the request from Node client, it will open the door and set it open for 3 seconds. However, if there is a new request coming in during that 3 seconds, the door will reset the timer to another 3 seconds. When the count down time is up, the door will lock again.</p>
<p>A random side note: Skygear is using AWS in America, while the door and the Raspberry Pi is in Hong Kong. Effectively, our ‘芝麻開門’ (Chima Open Door) request travels around the world before it reaches the door.</p>
<h3 id="heading-why-raspberry-pi">Why Raspberry Pi?</h3>
<p>Now, you may be wondering why we specifically chose Raspberry Pi. We considered using Arduino boards because we had them in the office. The reason we couldn’t use our specific Arduino model was because we wanted to synchronize data via Skygear JS SDK and this specific Arduino can’t set up the Node server.  </p>
<p> What’s more, Raspberry Pi is Bluetooth Low Energy ready (which means we could access the door lock using a third method, Bluetooth).</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*2SCzzCP-Xf2OrwKvw4Zh1A.jpeg" alt="Image" width="600" height="400" loading="lazy">
<em>Linus-based Raspberry Pi is compatible with Oursky’s open-source serverless platform, Skygear</em></p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*c47bsti5RIuXdrNrm1YbIA.jpeg" alt="Image" width="600" height="400" loading="lazy"></p>
<h3 id="heading-additional-integrations">Additional integrations</h3>
<p>Considering the app is internal-use only, we started a <a target="_blank" href="http://www.slack.com/">Slack</a> customized command <code>/chima-open-door</code> to open the door since every Ourskyer has access to <a target="_blank" href="http://www.slack.com/">Slack</a>.</p>
<p>Later some other Oursky colleagues got involved in this project and helped write the WatchOS app and Android app published on the internal platform. Apart from pressing the button inside the app, we also provide alternatives such as iOS 3D touch, Today extension, Android widget and even a Pebble integration because some of our developers use it.</p>
<p>That’s it! Before you dive in, there are two other main factors to consider: the reverse electricity flow (in this case for the Raspberry Pi) and the security of each of your integrations. For example, we also integrated Bluetooth app access with Bluetooth Low Energy (BLE), which has a self-implemented 2FA-like authentication. Other integrations you can include are notifications when the door is open (bell, LED).  </p>
<p> If you want to learn about any of the above, feel free to get in touch!</p>
<p><strong>Link to Repo / files</strong><br>Doorlock: <a target="_blank" href="https://github.com/oursky/doorlock">https://github.com/oursky/doorlock</a></p>
<p>I would like to credit my colleagues <a target="_blank" href="https://www.freecodecamp.org/news/how-to-over-engineer-a-door-lock-863b5d58dd0d/undefined">David Ng</a>, Boris (<a target="_blank" href="https://www.freecodecamp.org/news/how-to-over-engineer-a-door-lock-863b5d58dd0d/undefined">akiroz</a>), Brian (<a target="_blank" href="https://www.freecodecamp.org/news/how-to-over-engineer-a-door-lock-863b5d58dd0d/undefined">b壹貳參肆零零</a>), and <a target="_blank" href="https://www.freecodecamp.org/news/how-to-over-engineer-a-door-lock-863b5d58dd0d/undefined">May Yeung</a> for working on the Android application, the circuit implementation &amp; Clojure, Pebble application, and this blog piece respectively. Here’s to teamwork!</p>
<p>At Oursky we’re all about helping brands and entrepreneurs make their ideas happen, as well as fellow developers — our latest project Skygear (<a target="_blank" href="https://skygear.io">https://skygear.io</a>), an open source (<a target="_blank" href="https://github.com/skygeario">https://github.com/skygeario</a>) serverless platform for mobile, web &amp; IoT apps — helps you build better apps faster. ?</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
