I created a CloudFormation stack with a Yaml file template. The CFN template helped to automate the creation of an EC2 instance called 'CILEC2Ass' with an IAM role given for SSM and S3 access and an S3 bucket called 'Cilbucket'. I uploaded picture files into the S3 bucket through my management console and then connected via SSM to my EC2 instance. I copied the picture files in the s3 bucket to a directory called 'backs3objects' in my EC2's home directory. Finally, I wrote a Python script to automatically copy the contents of my s3 bucket to my directory on execution and a cron job to run the Python script at 5 p.m. every day.
Amazon EC2 is the building block of compute services in Amazon Web Services (AWS). Amazon Elastic Compute Cloud (Amazon EC2) provides on-demand, scalable computing capacity in the Amazon Web Services (AWS) Cloud. Using Amazon EC2 reduces hardware costs so you can develop and deploy applications faster. In simple terms, EC2 allows you to handle complex workloads in the cloud without having to physically manage and provision data centers.
Amazon S3 is a highly durable, available, and scalable object storage service. Customers of all sizes and industries can use Amazon S3 to store and protect any amount of data for a range of use cases, such as data lakes, websites, mobile applications, backup and restore, archive, enterprise applications, IoT devices, and big data analytics.
AWS IAM is a web service that helps you securely control access to your AWS resources. With IAM, you can centrally manage permissions that control which AWS resources users can access. You use IAM to control who is authenticated (signed in) and authorized (has permissions) to use resources. With IAM, you can also create roles that allows access to specific resources. IAM roles can be given to AWS resources to allow them access other resources, or other users in an organization.
AWS CloudFormation is a service that helps you model and set up your AWS resources so that you can spend less time managing those resources and more time focusing on your applications that run in AWS. You create a template that describes all the AWS resources that you want (like Amazon EC2 instances or Amazon RDS DB instances), and CloudFormation takes care of provisioning and configuring those resources for you. You don't need to individually create and configure AWS resources and determine what's dependent on what; CloudFormation handles that.
Sessions manager allowed me to connect to my EC2 instance without key pairs. Here's a screenshot of the code I used to copy files from my s3 bucket to a directory in my EC2 instance:
Here's a screenshot of the cloud architecture for the services discussed: