Here below is the puppet code to provision an EC2 instance on AWS cloud.
create-ec2-instance.pp
ec2_instance { 'My EC2 instance':ensure => present,
region => 'us-east-2',
image_id => 'ami-916f59f4',
instance_type => 't2.micro',
security_groups => ['mySecurityGroup'],
subnet => 'subnet-aff937d5',
key_name => 'my2019EC2Key',
}
ec2_securitygroup { 'mySecurityGroup':
region => 'us-east-2',
ensure => present,
description => 'Security group for aws advent',
ingress => [{
protocol => 'tcp',
port => 8080,
cidr => '0.0.0.0/0',
},{
protocol => 'tcp',
port => 80,
cidr => '0.0.0.0/0',
},{
protocol => 'tcp',
port => 22,
cidr => '0.0.0.0/0',
}],
tags => {
tag_name => 'mySecurityGroup',
},
}
And then execute the below command to create EC2 instance.
sudo /opt/puppetlabs/bin/puppet apply create-ec2.pp
Make sure you have access keys and secret keys downloaded from AWS.
sudo vi ~/.aws/credentials
[default]
aws_access_key_id = ?
aws_secret_access_key = ?
Excellent post. I learned a lot from this blog and I suggest my friends to visit your blog to learn new concept about technology.
ReplyDeleteAWS Training in Chennai
AWS course in Chennai
DevOps certification in Chennai
DevOps Training in Chennai
Data Science Course in Chennai
Data Science Training in Chennai
AWS Training in Velachery
AWS Training in Tambaram
Thank you for your valuable content , Easy to understand and follow. As said, the migration to cloud is very essential for the protection of the database.
ReplyDeleteCloud Migration services
Aws Cloud Migration services
Azure Cloud Migration services
Vmware Cloud Migration services
Database Migration services
I am definitely enjoying your website. You definitely have some great insight and great stories.
ReplyDeleteVPS Hosting India