Mastering AWS Infrastructure Automation with System Manager.
Ankit Kumar
Aspiring Cloud & DevOps Engineer | Python | C/C++ | FastAPI | Docker | Terraform.
Before you read this Session, please read all previous sessions. Let's begin the world of cloud computing using Amazon web services.
For configuring EC2 Instances automatically, AWS provides service called System Manger which is a centralized service used for configuring instances automatically.
AWS Systems Manager is a centralized management service offered by Amazon Web Services (AWS) that simplifies and automates operational tasks and administrative workflows for AWS resources. It provides a unified interface to manage AWS infrastructure, applications, and dependencies, making it easier to maintain security, compliance, and operational efficiency.
Key features of AWS Systems Manager include:
1. Automation: Automate repetitive tasks and workflows, such as patch management, software installation, and configuration updates, across AWS resources.
2. Parameter Store: Store and manage configuration data, secrets, and environment variables securely, making it easy to access and update them programmatically.
3. Run Command: Execute commands and scripts remotely on multiple instances simultaneously, streamlining administrative tasks and troubleshooting.
4. Session Manager: Gain secure, auditable access to EC2 instances and other AWS resources without the need for SSH or RDP credentials, improving security posture.
5. Patch Manager: Automate patch management for EC2 instances and on-premises servers, ensuring systems are up-to-date with the latest security patches and updates.
6. Inventory Management: Collect and track metadata and configuration details of managed instances, facilitating inventory management and compliance reporting.
7. Compliance: Monitor compliance with predefined policies and configurations, and remediate non-compliant resources automatically.
8. Maintenance Windows: Schedule maintenance activities, such as patching and updates, during specified timeframes to minimize impact on production systems.
There are two ways to configure an operating system or an EC2 instance:
1. Manual: Configuring the system or instance settings directly by hand, requiring human intervention and step-by-step actions.
2. Automatically: Using tools like AWS Systems Manager to automate the configuration process, allowing for streamlined and efficient setup without manual intervention.
领英推荐
Steps to allow an EC2 instance to use S3 and automate tasks using AWS Systems Manager:
1. Allowing EC2 to Use S3:
- Open IAM on the AWS Web Console.
- Create a new role with the trust entity type set as AWS Services.
- Choose EC2 as the source service (needing access) and S3 as the destination service.
- Grant the role permissions by selecting AmazonS3FullAccess or custom permissions based on your needs.
2. Assigning the Role to EC2 Instance:
- In the EC2 portal, select the instance that requires access to S3.
- Navigate to Actions > Security > Modify IAM role.
- Choose the role you created earlier to grant the instance access to S3.
3. Automating Tasks with Systems Manager:
- Create a role with the AmazonEC2RoleforSSM permission for Systems Manager.
- Modify the IAM role for EC2 instances to allow connection to Systems Manager.
- Connect to the EC2 instance and restart the amazon-ssm-agent using the command: $ systemctl restart amazon-ssm-agent.
- Use Systems Manager to run commands or scripts on the EC2 instance, such as testing commands like creating directories or installing software.
These steps enable seamless integration between EC2 instances and S3, and empower you to automate tasks efficiently using AWS Systems Manager.
Stay tuned for our next session, where we'll continue our journey into the vast world of cloud computing!