Sriram Fir
Sriram Fir
BACHELOR OF TECHNOLOGY
in
ARTIFICIAL INTELLIGENCE AND DATA SCIENCE
Submitted by
M. GALEIAH
M.Tech (PhD)
Assistant Professor
April-2024
STUDENT DECLARATION
I PADALA SRIRAM Regd.NO: 20B91A5443 here by declare that the internship report entitled
fulfillment of the requirement for the Bachelor of Technology (B.TECH.). This work is
an independent work and any help taken from the other people has been mentioned in
acknowledgment. Any part of this report and the report as a whole, therefore, has not been
Signature of Student
Abstract
Automate deployment of S3 bucket and static website with Terraform. Terraform configurations
define S3 bucket creation, static website hosting, access control, and lifecycle policies. Execute
Terraform scripts for consistent deployment and security adherence. Enable static website
hosting, granting public access via unique S3 endpoint. Apply access control policies for
regulated bucket access based on roles or IP addresses. Implement lifecycle policies for
automated object management, like storage class transitions and deletion. The project
underscores infrastructure as code's efficiency in AWS resource provisioning. It streamlines
deployment, ensuring scalability and maintainability. Terraform abstracts infrastructure
management into code, fostering agility and reducing time-to-market. Overall, the project
exemplifies modern cloud deployment practices for web applications.
Table of Contents
1. Introduction to AWS & Devops .................................................................................................... 1
1.1 AWS ....................................................................................................................................... 1
1.1.1 Advantages of AWS ........................................................................................................ 1
1.1.2 List of Services in AWS................................................................................................... 2
1.2 DEVOPS................................................................................................................................ 3
1.2.1 Advantage of Devops ...................................................................................................... 4
2. AWS & DEVOPS Tools Used .......................................................................................................... 6
2.1 Amazon S3 Storage ............................................................................................................... 6
2.2 Static Web Hosting ................................................................................................................ 9
2.3 Access Control List ............................................................................................................... 9
2.4 Terraform ............................................................................................................................ 10
3. Architecture ............................................................................................................................... 11
4. Implementation ......................................................................................................................... 12
5. OUTPUTS ................................................................................................................................... 20
1. Introduction to AWS & Devops
1.1 AWS
Amazon Web Services (AWS) revolutionized the tech industry by introducing a
comprehensive suite of cloud computing services that empower businesses to innovate and
scale rapidly. As a leading cloud provider, AWS offers a vast array of services, including
computing power, storage solutions, networking capabilities, and database management
tools, among others. Its pay-as-you-go pricing model and flexible infrastructure options
allow organizations to adapt quickly to changing business needs while optimizing costs.
With a global network of data centres, AWS ensures high availability and reliability,
enabling businesses of all sizes to leverage the power of the cloud to drive innovation and
growth.
In today's digital landscape, AWS plays a pivotal role in transforming how businesses
operate and deliver value to their customers. From startups to enterprise-level corporations,
organizations across industries rely on AWS to accelerate their digital transformation
journey. With its robust security features, compliance certifications, and extensive partner
ecosystem, AWS provides a secure and trusted platform for deploying mission-critical
applications and services. As businesses continue to embrace cloud computing as a strategic
imperative, AWS remains at the forefront, empowering enterprises to build scalable,
resilient, and agile solutions that drive business success in the modern era.
1.Scalability and Flexibility: AWS provides elastic computing resources that can scale up
or down based on demand. This allows businesses to quickly respond to changing
requirements and avoid over-provisioning or under-provisioning of resources.
2.Cost-effectiveness: With AWS's pay-as-you-go pricing model, businesses only pay for
the resources they use, without any upfront investment. This flexibility helps optimize costs
and align expenses with actual usage.
1
3.Global Infrastructure: AWS has a vast global network of data centers spread across
multiple regions and availability zones. This enables businesses to deploy applications
closer to end-users for low-latency access and ensures high availability and fault tolerance.
4.Security and Compliance: AWS offers a wide range of security features and compliance
certifications to protect data and meet regulatory requirements. This includes encryption,
identity and access management (IAM), and compliance with standards like GDPR and
HIPAA.
5.Reliability and Performance: AWS's infrastructure is designed for high reliability and
performance, with industry-leading service level agreements (SLAs) for uptime and
availability. This ensures that businesses can deliver consistent and responsive experiences
to their customers.
6.Innovation and Ecosystem: AWS continuously innovates and introduces new services
and features to meet evolving business needs. Its extensive ecosystem of partners and
thirdparty integrations further enhances the platform's capabilities and enables businesses
to build complex and innovative solutions.
Amazon, the preeminent cloud vendor, broke new ground by establishing the first cloud
computing service, Amazon EC2, in 2008. AWS offers more solutions and features than
any other provider and has free tiers with access to the AWS Console, where users
can
centrally control their ministrations.
Designed around ease-of-use for various skill sets, AWS is tailored for those
unaccustomed to software development utilities. Web applications can be deployed in
minutes with AWS
2
Cognito o Amazon Glacier o
Amazon SNS (Simple Notification Service) o
Amazon VPC (Virtual Private Cloud)
o Amazon Lightsail o Amazon CloudWatch
o Amazon Cloud9 o Amazon
Elastic Beanstalk o Amazon CodeCommit
o AmazonIAM(IdentityandAccessManagemen)
Quicksight
1.2 DEVOPS
At its core, DevOps emphasizes automation to achieve faster and more reliable software
delivery. By leveraging automation tools for infrastructure provisioning, configuration
management, and deployment pipelines, DevOps teams can eliminate manual, error-prone
tasks and achieve consistent and repeatable processes. Additionally, DevOps encourages
the adoption of agile principles and practices, such as iterative development, continuous
integration, and feedback loops, to enable rapid iteration and innovation. Ultimately,
DevOps represents a cultural shift in how organizations approach software development
and operations, promoting collaboration, transparency, and a relentless focus on delivering
value to customers.
3
1.2.1 Advantage of Devops
3.Increased Efficiency: Automation plays a key role in DevOps, reducing manual effort
and minimizing errors. By automating repetitive tasks like configuration management,
infrastructure provisioning, and testing, organizations can streamline processes, increase
productivity, and reduce time-to-market.
5.Scalability and Resilience: With DevOps, organizations can build scalable and resilient
systems by leveraging infrastructure as code (IaC) and cloud technologies. By treating
infrastructure as software, DevOps teams can automate the provisioning and scaling of
resources, ensuring that applications can handle fluctuating workloads and maintain high
availability.
6.Improved Feedback Loops: DevOps encourages the use of monitoring and feedback
mechanisms to gather insights into application performance and user behavior. By
collecting and analyzing data from production environments, teams can make informed
decisions, prioritize improvements, and continuously optimize their systems.
4
7.Cultural Transformation: Beyond technical practices, DevOps promotes a cultural shift
towards collaboration, experimentation, and continuous learning. By fostering a culture of
innovation and accountability, organizations can create a more adaptive and resilient
workforce capable of driving sustainable growth and innovation.
5
2. AWS & DEVOPS Tools Used
Elastic scalability—S3 has no storage limit. Individual objects can be up to 5TB in size.
Flexible data structure—each object is identified using a unique key, and you can use metadata to
flexibly organize data.
Downloading data—easily share data with anyone inside or outside your organization and enable
them to download data over the Internet.
Permissions—assign permissions at the bucket or object level to ensure only authorized users can
access data.
APIs – the S3 API, provided both as REST and SOAP interfaces, has become an industry standard
and is integrated with a large number of existing tools.
S3 also offers seamless integration with various backup and archival software. This allows
businesses to automate the backup and archival processes, reducing the risk of human error and
ensuring data is consistently protected. With S3’s versioning capabilities, organizations can also
retain multiple versions of their files, enabling roll back to previous versions if needed.
6
2. Content Distribution and Hosting:
By leveraging S3’s global network of edge locations, content creators can distribute their files
seamlessly to end-users, reducing latency and improving user experience. S3’s integration with
content delivery networks (CDNs) further enhances its content distribution capabilities, ensuring
that files are delivered quickly and efficiently.
Moreover, S3 storage is highly scalable, allowing businesses to handle high traffic spikes without
performance degradation. This makes it an ideal choice for hosting static websites, where content
is served directly from S3 buckets. With S3’s support for custom domain names and SSL
certificates, businesses can create a reliable and secure web hosting environment.
3. Disaster Recovery:
With S3’s cross-region replication, businesses can automatically save their data in multiple Amazon
regions, ensuring that it is protected against regional disasters. In the event of a disaster,
organizations can quickly restore their data from the replicated copies stored in S3, minimizing
downtime and data loss.
S3’s durability and availability also make it an excellent choice for storing backups of critical
systems and databases. By regularly backing up data to S3, organizations can quickly recover their
systems in the event of a failure, reducing the impact on business operations.
Additionally, S3 supports data lake architectures, allowing organizations to store structured and
unstructured data in its native format. This reduces the need for data transformation, reducing
complexity and enabling faster data processing. S3 tightly integrates with Amazon’s big data
analytics services like Amazon Athena and Amazon Redshift.
7
With S3’s support for access control policies and signed URLs, businesses can ensure that only
authorized users can access their distributed files. This provides an additional layer of security and
prevents unauthorized distribution or tampering of software packages.
Amazon S3 Storage Classes:
S3 provides storage tiers, also called storage classes, which can be applied at the bucket or object
level. S3 also provides lifecycle policies you can use to automatically move objects between tiers,
based on rules or thresholds you define.
8
2.2 Static Web Hosting
Static web hosting involves serving web pages and content directly from a web server without the
need for server-side processing or dynamic content generation. It is ideal for websites with fixed
content that rarely changes, such as informational sites, portfolios, blogs, and documentation pages.
Static web hosting simplifies the infrastructure requirements as it only requires a web server to
serve the static files, typically HTML, CSS, JavaScript, images, and other media files. This
approach offers several advantages, including fast performance, low cost, high scalability, and
simplicity in deployment and maintenance. Static web hosting is often used in combination with
content delivery networks (CDNs) to further enhance performance and global availability by
caching content at edge locations closer to end-users.
Businesses and individuals commonly use static web hosting for a variety of purposes, including
hosting personal websites, company landing pages, product documentation, and marketing
websites. It is particularly well-suited for projects where simplicity, speed, and cost-effectiveness
are priorities. Static web hosting platforms and services, such as Amazon S3, GitHub Pages, Netlify,
and Firebase Hosting, offer easy-to-use tools and features for deploying, managing, and scaling
static websites, making them accessible to users of all skill levels without the need for extensive
server administration or development expertise.
Terraform is an open-source infrastructure as code (IaC) tool that enables users to define and
provision infrastructure resources using a declarative configuration language. With Terraform,
infrastructure is described in configuration files, known as Terraform scripts, which specify the
desired state of the infrastructure. Terraform then automatically manages and orchestrates the
9
provisioning of resources across various cloud providers, data centers, and service providers,
ensuring consistency and repeatability in infrastructure deployment. Terraform supports a wide
range of cloud services and providers, including Amazon Web Services (AWS), Microsoft Azure,
Google Cloud Platform (GCP), and more, making it a versatile tool for managing infrastructure
across hybrid and multi-cloud environments.
2.4 Terraform
Terraform is an open-source infrastructure as code (IaC) tool that allows users to define and
provision infrastructure resources using a declarative configuration language. With Terraform,
infrastructure is described in configuration files, known as Terraform scripts, which specify the
desired state of the infrastructure. Terraform then automatically manages and orchestrates the
provisioning of resources across various cloud providers, data centers, and service providers,
ensuring consistency and repeatability in infrastructure deployment. Terraform supports a wide
range of cloud services and providers, including Amazon Web Services (AWS), Microsoft Azure,
Google Cloud Platform (GCP), and more, making it a versatile tool for managing infrastructure
across hybrid and multi-cloud environments.
Terraform follows a "write, plan, and apply" workflow, where users first define their infrastructure
configuration in Terraform scripts, then use Terraform commands to generate an execution plan and
apply the changes to the infrastructure. This workflow enables users to manage infrastructure
changes in a controlled and predictable manner, with Terraform providing features for dependency
management, resource tracking, and state management to ensure that changes are applied safely
and efficiently. Terraform's declarative approach to infrastructure management allows users to
focus on describing the desired end state of their infrastructure rather than worrying about the
underlying implementation details, resulting in simpler, more maintainable, and more predictable
infrastructure configurations.
10
3. Architecture
11
4. Implementation
In the providers.tf file, we specify the required providers for our Terraform configuration. In this
case, we require the AWS provider from HashiCorp with version 5.47.0.
The provider block configures the AWS provider with specific settings. Here, we specify the AWS
region as "ap-south-1" to deploy our resources in the Asia Pacific (Mumbai) region.
In the variables.tf file, we define a variable named "bucketname" with a default value of
"mybucketstaticweb-hosting-2024".
Variables in Terraform allow us to parameterize our configuration, making it more flexible and
reusable across different environments.
12
Step 3: Creating AWS S3 Bucket and Objects (main.tf):
• In the main.tf file, we define resources to create an AWS S3 bucket (aws_s3_bucket) named
"mybucket" using the variable "bucketname".
•
In AWS S3:
13
• We also configure ownership controls (aws_s3_bucket_ownership_controls) and public
access block settings (aws_s3_bucket_public_access_block) for the bucket to ensure
security and compliance.
• Finally, we upload static files (index.html, error.html, pro1.jpeg, proj2.jpg) to the S3 bucket
using aws_s3_object resources, setting appropriate ACLs and content types.
14
After running the command “terraform apply -auto-approve” the object (index.html, error.html,
pro1.jpeg, poej2.jpg) get uploaded into the bucket.
In AWS S3:
15
Index.html:
Error.html:
16
Pro1.jpeg:
Proj2.jpg:
17
aws_s3_bucket_website_configuration resource. This includes specifying the index and error
documents for the website.
After running the “terraform apply -auto-approve” our static website will be created, output in
terminal after this step will be:
In AWS S3:
18
19
5. OUTPUTS
20